0 Replies Latest reply on Sep 4, 2008 12:58 PM by Jay Perkins

    Error using two datasources with the same connection informa

    Jay Perkins Newbie

      I am using JBoss AS5 Beta 4

      The scenario only seems to be a problem when the two resources point to the same database. Using two datasources that connect to completely different databases works without issue.

      Here is the transactional scenario:

      T1 started
      T2 started (REQUIRES_NEW) - T1 suspended
      DataSource 1 does some work (inserts some records - Table 1)
      T2 commits - T1 resumes
      DataSource 1 does some work (selects some records - Table 1)
      DataSource 2 does some work (inserts a record - Table 2)

      Boom with the following error:

      12:37:40,303 WARN [loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.xastart] [com.arjuna.ats.internal.jta.transaction.arjunacore.xastart] TransactionImple.enlistResource - xa_start - caught: [com.arjuna.ats.jta.utils.unknownerrorcode] Unknown error code:0 for < 131075, 27, 25, 1--53effea2:569:48c00e50:6c-53effea2:569:48c00e50:79
      12:37:40,303 ERROR [STDERR] javax.transaction.xa.XAException: java.sql.SQLException: DTC_XA_START:Status:0 msg:*** SQLJDBC_XA DTC_ERROR Context: xa_start, state=7, StatusCode:-3 (0xFFFFFFFD) ***
      12:37:40,303 ERROR [STDERR] at com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(Unknown Source)
      12:37:40,303 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.start(XAManagedConnection.java:188)
      12:37:40,303 ERROR [STDERR] at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:865)
      12:37:40,303 ERROR [STDERR] at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:499)
      12:37:40,303 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$TransactionSynchronization.enlist(TxConnectionManager.java:827)
      12:37:40,303 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:618)
      12:37:40,303 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:375)
      12:37:40,303 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnectManagedConnection(BaseConnectionManager2.java:516)
      12:37:40,303 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:397)
      12:37:40,303 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:838)
      12:37:40,303 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
      12:37:40,303 ERROR [STDERR] at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:47)
      12:37:40,303 ERROR [STDERR] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
      12:37:40,303 ERROR [STDERR] at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)

      Am I doing something wrong or is this not supported?

      Below is my data-sources-ds.xml:

      <datasources>
       <attribute name="SecurityDomainJndiName">SimpleSQLDbRealm</attribute>
       <xa-datasource>
       <jndi-name>logic-simple-tbservice-tbstore-TBStorePU-ds</jndi-name>
       <track-connection-by-tx />
       <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
       <min-pool-size>1</min-pool-size>
       <max-pool-size>10</max-pool-size>
      
       <xa-datasource-property name="User">blah</xa-datasource-property>
       <xa-datasource-property name="Password">blah</xa-datasource-property>
       <xa-datasource-property name="ServerName">blahserver</xa-datasource-property>
       <xa-datasource-property name="PortNumber">1433</xa-datasource-property>
       <xa-datasource-property name="DatabaseName">blah</xa-datasource-property>
       </xa-datasource>
      
       <mbean code="org.jboss.naming.NamingAlias" name="SimpleSQLDbRealm:service=NamingAlias,fromName=logic-simple-tbservice-tbstore-TBStorePU-ds">
       <attribute name="ToName">java:/logic-simple-tbservice-tbstore-TBStorePU-ds</attribute>
       <attribute name="FromName">logic-simple-tbservice-tbstore-TBStorePU-ds</attribute>
       </mbean>
      
       <xa-datasource>
       <jndi-name>logic-simple-transactionservice-tastore-TAStorePU-ds</jndi-name>
       <track-connection-by-tx />
       <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
       <min-pool-size>1</min-pool-size>
       <max-pool-size>10</max-pool-size>
      
       <xa-datasource-property name="User">blah</xa-datasource-property>
       <xa-datasource-property name="Password">blah</xa-datasource-property>
       <xa-datasource-property name="ServerName">blahserver</xa-datasource-property>
       <xa-datasource-property name="PortNumber">1433</xa-datasource-property>
       <xa-datasource-property name="DatabaseName">blah</xa-datasource-property>
       </xa-datasource>
      
       <mbean code="org.jboss.naming.NamingAlias" name="SimpleSQLDbRealm:service=NamingAlias,fromName=logic-simple-transactionservice-tastore-TAStorePU-ds">
       <attribute name="ToName">java:/logic-simple-transactionservice-tastore-TAStorePU-ds</attribute>
       <attribute name="FromName">logic-simple-transactionservice-tastore-TAStorePU-ds</attribute>
       </mbean>
      
      
      </datasources>