6 Replies Latest reply on Sep 17, 2007 1:58 AM by emo

    Connection error OracleXAException -> XAResource.start, coul

    emo

      I am starting out with the XA paradigm and am now confused. Sorry if this is a FAQ, but I cannot find it.

      I have jboss-4.2.1.GA installed and just one configured XA Resource for now. I am trying to implement a Container Managed EJB, as per the O'Reilly EJB 3.0 textbook. So am not using UserTransactions. The call to datasource.getConnection throws a sequence of familiar sounding exceptions. Can I get some advice how this is supposed to work?

      Many Thanks, E.

      The code is as per JBoss Txn API 4.2.3 Programmers Guide, which advices the JNDI URL is prepended with jdbc:aruna

      try {
      InitialContext ic = new InitialContext();
      datasource = (DataSource) ic.lookup
      ("java:comp/env/jdbc:arjuna:jdbc/myDataSource");
      } catch (NamingException ne) { ...}

      try {
      dbConnection = datasource.getConnection();
      } catch (Exception e) { ...}

      The console error shows:
      [TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@13cc73c
      [state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@13c5cc8 handles=0 lastUse=1188790474123 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@1ef5e7d context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@247b2e xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@1131d98 txSync=null]
      oracle.jdbc.xa.OracleXAException

      WARN [loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror] [com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror] TransactionImple.enlistResource - XAResource.start returned: XAException.XAER_RMERR

      SQLException during retrieval of user profile : Could not enlist in transaction on entering meta-aware object!;



      BTW, the JNDI tree shows:
      java:comp namespace of the myUser bean:
      +- env (class: org.jnp.interfaces.NamingContext)
      | +- jdbc:arjuna:jdbc (class: org.jnp.interfaces.NamingContext)
      | | +- myDataSource[link -> java:/XAOracleDS] (class: javax.naming.LinkRef)

      The oracle-xa-ds.xml datasoure configuration is:
      <!-- Datasource 1 -->

      <xa-datasource>
      <jndi-name>XAOracleDS</jndi-name>
      <track-connection-by-tx/>
      <isSameRM-override-value>false</isSameRM-override-value>
      <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
      <xa-datasource-property name="URL">jdbc:oracle:thin:@saki:1521:AC51</xa-datasource-property>
      <xa-datasource-property name="User">tmsuser</xa-datasource-property>
      <xa-datasource-property name="Password">tms</xa-datasource-property>

      <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
      <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
      <!-- Checks the Oracle error codes and messages for fatal errors -->
      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

      <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
      <min-pool-size>0</min-pool-size>

      <!-- The maximum connections in a pool/sub-pool -->
      <max-pool-size>5</max-pool-size>

      <!-- The time before an unused connection is destroyed -->
      <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
      <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
      <idle-timeout-minutes>0</idle-timeout-minutes>

      <!-- sql to call on an existing pooled connection when it is obtained from pool -->
      <check-valid-connection-sql>select * from TMSUSR</check-valid-connection-sql>

      <!-- class that determines a connection is valid before it is handed out from the pool -->
      <valid-connection-checker-class-name>
      org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker
      </valid-connection-checker-class-name>

      <!-- Whether to check all statements are closed when the connection is returned to the pool,
      this is a debugging feature that should be turned off in production -->
      <track-statements/>

      <!-- Oracle's XA DS cannot reuse a connection outside a txn once enlisted in a global txn and vice-versa -->
      <no-tx-separate-pools/>

      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->

      <type-mapping>Oracle9i</type-mapping>


      </xa-datasource>


      jboss-service.xml

      true




        • 1. Re: Connection error OracleXAException -> XAResource.start,
          marklittle

          The JDBC text in the JBossTS programmers guide is only for use when running outside of an application server. You do not have to do anything special when running within JBossAS, so ignore that text.

          • 2. Re: Connection error OracleXAException -> XAResource.start,
            emo

            Thanks for this advice, it has simplified things for me. Now the code uses a regular JNDI "java:comp/env/jdbc/TMSDataSource".

            I now get the following error: "Abort of action invoked while multiple threads active within it." I have attached the logs. This occurs during

            dbConnection = datasource.getConnection();

            Any advice would be apprieciated, thanks, E.

            [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58]
            - Abort of action id -3f57fe87:4eb:46dc9c43:4c invoked while multiple threads active within it.
            [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2]
            - CheckedAction::check - atomic action -3f57fe87:4eb:46dc9c43:4c aborting with 1 threads active!
            SQLException : Transaction is not active: tx=TransactionImple
            < ac, BasicAction: -3f57fe87:4eb:46dc9c43:4c status: ActionStatus.ABORTED >;
            - nested throwable: (javax.resource.ResourceException:

            09:53:05,899 ERROR [STDERR] Caused by: javax.resource.ResourceException: Transaction is not active:
            tx=TransactionImple < ac, BasicAction: -3f57fe87:4eb:46dc9c43:4c status: ActionStatus.ABORTED >
            at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:304)
            at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
            at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
            at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)


            TransactionRolledbackException in method: java.rmi.RemoteException, causedBy:
            java.lang.IllegalStateException:
            [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive]
            [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive]
            The transaction is not active!
            at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commit(TransactionImple.java:223)


            • 3. Re: Connection error OracleXAException -> XAResource.start,
              marklittle

              This warning means that the transaction you are trying to terminate has already been ternated. Looks like you are trying to commit it when something else has rolled it back. I'd guess that this is a timeout issue, i.e., TS has rolled back your transaction because the default timeout associated with it went off. Try increasing the timeout. If that doesn't help, attach a debugger and monitor the threads and transactions. (Turning on JBossTS debugging may help you.)

              • 4. Re: Connection error OracleXAException -> XAResource.start,
                emo

                Thank you for your previous advice, and I have increased the timeout & turned on debug. The same error message occurs but with this extra information: "Start transaction failed for org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@19fc023". An extract from the server.log is attached.

                I hope this information is enough, thanks in advance, E.

                The timeout is increased from 300 to 1300 in jboss-service.xml

                <!-- JBoss Transactions JTA -->

                1300
                ${jboss.server.data.dir}/tx-object-store


                The logging is set to FULL in jbossjta-properties.xml

                <!-- CLF 2.0 properties -->


                jboss-4.2.1.GA\server\default\log\server.log

                2007-09-12 14:48:04,324 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] supplying new ManagedConnection: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@133092e[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@19fc023 handles=0 lastUse=1189572484324 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@32c41c context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@ff65bf xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@171157a txSync=null]

                2007-09-12 14:48:04,324 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Got connection from pool tracked by transaction org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@133092e[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@19fc023 handles=0 lastUse=1189572484324 permit=true trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@32c41c context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@ff65bf xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@171157a txSync=null] tx=TransactionImple < ac, BasicAction: -3f571edb:6aa:46e76d5f:57 status: ActionStatus.RUNNING > [InUse/Available/Max]: [1/4/5]

                2007-09-12 14:48:04,340 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.getStatus
                2007-09-12 14:48:04,340 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.getStatus

                2007-09-12 14:48:04,340 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Using connection from pool tracked by transaction org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@133092e[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@19fc023 handles=0 lastUse=1189572484324 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@32c41c context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@ff65bf xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@171157a txSync=null] tx=TransactionImple < ac, BasicAction: -3f571edb:6aa:46e76d5f:57 status: ActionStatus.RUNNING > [InUse/Available/Max]: [1/4/5]

                2007-09-12 14:48:07,586 DEBUG [com.arjuna.ats.jta.logging.logger] BaseTransaction.getStatus
                2007-09-12 14:48:07,586 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.getStatus

                2007-09-12 14:48:07,586 TRACE [org.jboss.resource.connectionmanager.TxConnectionManager] Pre-enlist: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@133092e[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@19fc023 handles=0 lastUse=1189572484324 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@32c41c context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@ff65bf xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@171157a txSync=null] threadTx=TransactionImple < ac, BasicAction: -3f571edb:6aa:46e76d5f:57 status: ActionStatus.RUNNING >

                2007-09-12 14:48:07,586 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.getStatus

                2007-09-12 14:48:07,586 TRACE [org.jboss.resource.connectionmanager.TxConnectionManager] Get synchronizer org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@133092e[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@19fc023 handles=0 lastUse=1189572484324 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@32c41c context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@ff65bf xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@171157a txSync=null] threadTx=TransactionImple < ac, BasicAction: -3f571edb:6aa:46e76d5f:57 status: ActionStatus.RUNNING >

                2007-09-12 14:48:07,586 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.getStatus
                2007-09-12 14:48:07,602 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.registerSynchronization
                2007-09-12 14:48:07,602 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.getStatus

                2007-09-12 14:48:07,602 TRACE [org.jboss.resource.connectionmanager.TxConnectionManager] Enlisting resource org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@133092e[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@19fc023 handles=0 lastUse=1189572484324 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@32c41c context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@ff65bf xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@171157a txSync=TxSync20516810{tx=TransactionImple < ac, BasicAction: -3f571edb:6aa:46e76d5f:57 status: ActionStatus.RUNNING > wasTrackByTx=true enlisted=false}]

                2007-09-12 14:48:07,602 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.enlistResource ( org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@171157a )

                2007-09-12 14:48:07,602 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.getStatus
                2007-09-12 14:48:07,899 ERROR [org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory] Start transaction failed for org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@19fc023

                2007-09-12 14:48:07,899 WARN [org.jboss.resource.connectionmanager.TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@133092e[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@19fc023 handles=0 lastUse=1189572484324 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@32c41c context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@ff65bf xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@171157a txSync=null]
                oracle.jdbc.xa.OracleXAException
                at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1157)
                at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:295)
                at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.start(XAManagedConnection.java:121)
                at org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper.start(JcaXAResourceWrapper.java:113)
                at com

                • 5. Re: Connection error OracleXAException -> XAResource.start,
                  marklittle

                  I'm on vacation and will check this next week.

                  • 6. Re: Connection error OracleXAException -> XAResource.start,
                    emo

                    Hello Mark,

                    Oracle throws an XAException (XAER_RMERR and OracleXAException code 131075) when XAResource.start is called on my single resource, as per log snippet below. Is there an issue with Oracle 9.2 transaction serializability? The isolation level is not set in jbossjta-properties.xml so the isolation level is the default setting.

                    jboss-4.2.1.GA\server\default\conf\jbossjta-properties.xml

                    <!-- property name="com.arjuna.ats.jdbc.isolationLevel" value="TRANSACTION_SERIALIZABLE"/> -->



                    DEBUG Starting jboss.jca:service=ManagedConnectionFactory,name=XAOracleDS
                    DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Not setting config property 'TransactionIsolation'
                    WARN [org.jboss.resource.connectionmanager.TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@146e161[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@76da32 handles=0 lastUse=1190005212104 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@ef2ab5 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@1dcd5a8 xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@14f0fb4 txSync=null]
                    oracle.jdbc.xa.OracleXAException at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1157)
                    ERROR [org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory] Start transaction failed for org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@76da32
                    WARN [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror] [com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror]
                    TransactionImple.enlistResource - XAResource.start returned: XAException.XAER_RMERR for < 131075, 27, 25, 1--3f57fe77:4d4:46ee099b:4c3f57fe77:4d4:46ee099b:63 >
                    DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.setRollbackOnly