1 Reply Latest reply on Aug 20, 2012 10:15 AM by pedrokowalski

    XAResource#start(-) invoked more than once for the same Tx

    pedrokowalski

      Hi,

       

      I'm fairly new to the JCA and I've got the following problem:

       

      My JCA adapter that uses the XATransactions (<transaction-support>XATransaction</transaction-support>) is deployed fine but when I try to invoke the outflow connection, my resource adapter's XAResource#start(-) method is invoked multiple times causing nasty exceptions from my third-party system).

       

      More precisely, my ManagedConnection's getXAResource() is invoked and it returns my XAResource implementation (for the same ManagedConnection it always returns always the same XAResource.) Then it invokes my XAResource#setTransactionTimeout(-) and XAResource#start(-). Few methods invocations later (not under my responsibility), the same thread executes the XAResource#setTransactionTimeout(-) and XAResource#start(-) with the same Xid (without calling end(), rollback(), commit(), ...)

       

      I am using the JBoss AS 7.1.1Final but I've also tested it with nightlybuild of JBoss AS 7.x (https://ci.jboss.org/jenkins/job/JBoss-AS-7.x-latest/).

      I am invoking the ConnectionFactory from within the EJB (REQUIRED), so the JTA is in charge of the transaction management, right?

       

      I would be much obliged if you could point me where should I look for the cause of this behavior.

       

      I've read in JTA 1.1 spec (3.4.4 Transaction Association) that:

       

      "Global transactions are associated with a transactional resource via the XAResource.start method, and disassociated from the resource via the XAResource.end method. The resource adapter is responsible for internally maintaining an association between the resource connection object and the XAResource object. At any given time, a connection is associated with a single transaction or it is not associated with any transaction at all."

       

      but I guess this doesn't fit my case as this is the same transaction (same Xid) it tries to invoke the start(-) method...

        • 1. Re: XAResource#start(-) invoked more than once for the same Tx
          pedrokowalski

          After downloading the sources of JBoss TS JTA project in the exact same version (4.16.4) after debugging the com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple#enlistResource(-) it occurred that there was a silent OracleXAException without any stacktrace or error code thrown from xaRes.start(-). The Transaction Manager have some fixed number of retries in such case, so it invoked once again my XAResource methods.

           

          After knowing that this is an Oracle related exception I suspected it's a module-related issue. I've removed the Oracle JDBC from my RAR libs, added the latest version to the server modules and added dependencies in jboss-deployment-structure.xml. After those changes, it started working.

           

          Hope this will help someone else and prevent him from spending few hours of happy debugging.

           

          Cheers!