none
xa transactions fails during commit

    問題

  • im having trouble with xa transactions if the transaction is managed by the bean. if i switch back to a container managed transaction it seams to have read access but NOT INSERT/UPDATE.  i cant seem to find anyone that has posted this same error

    windows  server 2003 x64 sp2

    sql server 2005 9.0.4035

    ms sql jdbc 3.0 driver

    jboss 5.1.0.GA


    [TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@7fffc09c[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@1528ea5d handles=0 lastUse=1330350981451 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@54e55fbf context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@1ef12024 xaResource=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@1528ea5d txSync=null]
    javax.transaction.xa.XAException: The function START: has failed. The status is: -3. Error: "*** SQLJDBC_XA DTC_ERROR Context: FInitTranManWithTC, state=4, StatusCode:-3 (0xFFFFFFFD) ***"
        at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:545)
        at com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(SQLServerXAResource.java:674)
        at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.start(XAManagedConnection.java:213)

    [1] Client side:

    1. Which OS platform are you running on? centos 6.2
    2. Which JVM are you running on? (please specify) Sun- 1.6 jdk
    3. What is the connection URL in you app? (please specify) 
     <xa-datasource>
        <jndi-name>coreDatasource</jndi-name>
        <track-connection-by-tx>true</track-connection-by-tx>
        <isSameRM-override-value>false</isSameRM-override-value>
        <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
        <xa-datasource-property name="ServerName">x.x.x.x</xa-datasource-property>
        <xa-datasource-property name="databaseName">WC1Oct2010</xa-datasource-property>
        <xa-datasource-property name="SelectMethod">cursor</xa-datasource-property>
        <xa-datasource-property name="User">xxxx</xa-datasource-property>
        <xa-datasource-property name="Password">xxx</xa-datasource-property>
    
          <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
          <metadata><type-mapping>MS SQLSERVER2000</type-mapping></metadata>
      </xa-datasource>
    1. Is the client remote or local to the SQL server machine? Remote
    2. Is your client computer in the same domain as the Server computer? client is on the same subnet but not the same domain

     

    [2] Server side:

     

    1. What is the MS SQL version? sql server 2005 9.0.4035
    2. Does the server start successfully? yes

    i should probably also add that im not having trouble with the initial connection to the server. my app loads the meta data from the server without problem and validates the schema. this is happening with the first attempt to execute an sql query through jdbc.

    any help would be greatly appreciated.


    2012年2月27日 下午 02:45

所有回覆

  • Hi monarch_nathan.dennis,

    I would like to involve someone familiar with this issue to have a look, and give an update as soon as possible. Thanks for your understanding. 
     

    Stephanie Lv

    TechNet Community Support


    2012年3月7日 上午 07:55
  • that would be good. i have made the xa transactions come to life at this point, but i believe there to be an undocumented feature in the server. If i had to guess, i would say it had to do with initially trying to make the xa transaction before it was turned on. the reason i say that is we have two identical servers. one is a test server and the other a production server. they are from the same snap shot. on the production server everything worked perfectly as documented, but on the test server we got the error. the only difference in the proceedure was that i had tried to open an xa connection to the test server before realizing our dba didnt have it enabled.

    so i believe there is a bug to chase down here... but good news is the work around is simple. execute the sample code in the documentation where you set the Xid manually.. ie


          // Bytes 4 -> 7 - unique transaction id.
          // Bytes 8 ->11 - thread id.
          // Bytes 12->15 - random number generated by using seed from current time in milliseconds.
          for (int i=0; i<=3; i++) {
             gtrid[i+4] = (byte)(txnUID%0x100);
             bqual[i+4] = (byte)(txnUID%0x100);
             txnUID >>= 8;
             gtrid[i+8] = (byte)(tidID%0x100);
             bqual[i+8] = (byte)(tidID%0x100);
             tidID >>= 8;
             gtrid[i+12] = (byte)(randID%0x100);
             bqual[i+12] = (byte)(randID%0x100);
             randID >>= 8;
          }

    and having changed nothing in your original code... presto.. original code goes right to working too. as long as these quirks are documented and their workaround available, this isnt a serious bug.  it just cost me 2 weeks because no one had ran into it yet.

    2012年3月7日 下午 12:44
  • As per exception, looks like XA_START failed but I am not sure about Context: FInitTranManWithTC.  I don't find anything about Context: FInitTranManWithTC.

    javax.transaction.xa.XAException: The function START: has failed. The status is: -3. Error: "*** SQLJDBC_XA DTC_ERROR Context: FInitTranManWithTC, state=4, StatusCode:-3 (0xFFFFFFFD) ***"
         at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:545)
         at com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(SQLServerXAResource.java:674)


    This definitely needs research and troubleshooting time. I think you should open a regular CTS case so that we can collect JDBC XA and DTC traces and troubleshoot this issue.

    2012年5月9日 下午 09:01