SqlServer2005 Exception

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

SqlServer2005 Exception

gersav
I suspect that this is some issue with SqlServer configuration, but I am getting the following exception on initial query to the DB,

Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an XAResourceHolderState with uniqueName=jdbc/terminalds XAResource= XAResourceID:2 with XID a Bitronix XID [766973696F6E2D7365727665722D696400000120B528AD3700002820 : 766973696F6E2D7365727665722D696400000120B528AF5900002822], error=XAER_RMERR
        at bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:83)
        at bitronix.tm.resource.common.TransactionContextHelper.enlist(TransactionContextHelper.java:267)
        at bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:49)
        at bitronix.tm.resource.jdbc.JdbcConnectionHandle.enlistResource(JdbcConnectionHandle.java:59)
        ... 95 more
Caused by: javax.transaction.xa.XAException: com.microsoft.sqlserver.jdbc.SQLServerException: The function START: has failed. No transaction cookie was returned.
        at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:642)
        at com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(SQLServerXAResource.java:674)
        at bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:179)
        at bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:89)
        at bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:76)
        ... 98 more

My data source config is as follows

<bean id="dataSource-terminalds" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close">
         <property name="className" value="com.microsoft.sqlserver.jdbc.SQLServerXADataSource" /> 
         <property name="uniqueName" value="jdbc/terminalds" /> 
         <property name="minPoolSize" value="1" /> 
         <property name="maxPoolSize" value="10" /> 
         <property name="acquisitionInterval" value="1" /> 
         <property name="acquisitionTimeout" value="15" /> 
         <property name="maxIdleTime" value="15" /> 
         <property name="testQuery" value="select count(*) from dbo.sysobjects" /> 
         <property name="automaticEnlistingEnabled" value="true" /> 
         <property name="allowLocalTransactions" value="true" /> 
         <property name="driverProperties" >
          <props>
          <prop key="user">sa</prop>
          <prop key="password">sa</prop>
          <prop key="serverName">testServer</prop>
          <prop key="databaseName">testDB</prop>
          <prop key="uRL">jdbc:sqlserver://testServer/testDB</prop>
          </props> 
         </property>
</bean>

From other reports on the forum, I noticed that allowLocalTransactions set to true had caused a similar exception in Oracle, but the SqlServer info on the Btm website said that allowLocalTransactions=true should be ok.
Has anyone seen a similar issue?
Reply | Threaded
Open this post in threaded view
|

Re: SqlServer2005 Exception

Ludovic Orban
Administrator
Indeed, this looks like a database configuration problem.

I remember that getting SQL server running with JDBC XA is complex. There are 3 major steps involved:

 - install the sqljdbc_xa DLL shipped with the MS JDBC driver in SQL server's engine
 - configure Windows's DTC Service for XA
 - grant the SqlJDBCXAUser role to the users you're going to use for the PoolingDataSource

This is all documented on this page: http://msdn.microsoft.com/en-us/library/aa342335.aspx

I also remember that Windows XP lacks some DTC internal components that prevents it to be used fro JDBC XA unless some patch (which is only available directly from Microsoft Support and only for the English version of XP, see http://support.microsoft.com/kb/922668) is applied. I've heard that this patch has been included in XP Service Pack 3 but I cannot confirm this.

This is pretty much all I can do for you. If you still have problems I suggest you to ask for help in the Microsoft forums: http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/threads

Good luck,
Ludovic

Reply | Threaded
Open this post in threaded view
|

Re: SqlServer2005 Exception

Syny_Shreya
This post was updated on .
Hello,

I am inconsistently getting followoing excepiton while running the application with JDBC2 driver. This exception is specially seen when mutiple threads of application are running.

An unexpected exception has occurred while trying to create report with roster id 2.
Hibernate operation: could not insert: [com.core.processing.impl.model.TempResource]; uncategorized SQLException for SQL [insert into RESOURCE_REGISTER (RR_DATABASE, RR_OWNER_ID, RR_RESOURCE_NAME, RR_RESOURCE_TYPE, RR_RUN_ID) values (?, ?, ?, ?, ?)]; SQL state [null]; error code [0]; error enlisting a JdbcConnectionHandle of a JdbcPooledConnection from datasource metadata1 in state ACCESSIBLE wrapping SQLServerXAConnection:1 on  ProxyConnectionID:1; nested exception is java.sql.SQLException: error enlisting a JdbcConnectionHandle of a JdbcPooledConnection from datasource metadata1 in state ACCESSIBLE wrapping SQLServerXAConnection:1 on  ProxyConnectionID:1
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator translate 83
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator translate 80
org.springframework.orm.hibernate3.HibernateAccessor convertJdbcAccessException 424
org.springframework.orm.hibernate3.HibernateAccessor convertHibernateAccessException 410
org.springframework.orm.hibernate3.HibernateTemplate doExecute 411
org.springframework.orm.hibernate3.HibernateTemplate executeWithNativeSession 374
org.springframework.orm.hibernate3.HibernateTemplate save 683 ....

...... cannot enlist an XAResourceHolderState with uniqueName=metadata1 XAResource= XAResourceID:1 with XID a Bitronix XID [53757065727669736F72310000012B5A85EF5300000E7E : 53757065727669736F72310000012B5A85EF5300000E7F], error=XAER_RMERR.........com.microsoft.sqlserver.jdbc.SQLServerException: The function START: has failed. No transaction cookie was returned.

Sql server and machine cofiguration :  Microsoft SQL Server 2005 - 9.00.4305.00 (X64)  (With both Cumulative updates 9 & 10 installed as per http://www.sqlteam.com/article/sql-server-versions). OS is 64 bit Windows Server 2003.

I referred 'reply above' and http://msdn.microsoft.com/en-us/library/aa342335.aspx. The configuration settings seem to be correct as sometimes applications works properly. As the OS has SP2 appiled there is no need of 'MS DTC and XA Transactions hotifx' as mentioned in 'Guidelines and Limitations when Using XA Transactions'.

Can someone help me out?

Thanks in advance,
Syny_Shreya


Reply | Threaded
Open this post in threaded view
|

Re: SqlServer2005 Exception

Ludovic Orban
Administrator
This once again looks like a problem either in SQL server or in its JDBC driver.

The only suggestion I have is to contact Microsoft's support...
Reply | Threaded
Open this post in threaded view
|

Re: SqlServer2005 Exception

Syny_Shreya
Thanks for your reply :). I will try out there.

-Syny_Shreya