SqlServer2005 Exception

View: New views
2 Messages — Rating Filter:   Alert me  

SqlServer2005 Exception

by gersav :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

Re: SqlServer2005 Exception

by Ludovic Orban :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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