4 Replies Latest reply on Aug 12, 2012 11:47 PM by girish_n

    JBoss default Xid generator

    girish_n

      Hi,

       

      We are using JBoss EAP 5.1.0 with WebMethods Broker for Messaging for one of the project. I have deployed a MDB which receives messages from Broker.

       

      With XA Transactions we have an issue, the default Xid generator in JBoss generates same (non-unique) Xid for more than one Transaction.

       

      Say 2 Transactions T1 and T2 are started with same Xid 13087:1238965a33. If T1 is aborted and after that T2 commit is called then jBoss throws "Could not commit transaction" exception com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted.

       

      I believe this is happening because default Xid generator in JBoss generates Xid from timestamp. On a millisecond scale it is possible that same Xid is generated more than once.

       

      Is there a way that we can change default Xid generator and generate unique Xid everytime?

       

      Thanks in advance..

        • 1. Re: JBoss default Xid generator
          jhalliday

          > the default Xid generator in JBoss generates same (non-unique) Xid for more than one Transaction.

           

          No, it doesn't.

           

          > default Xid generator in JBoss generates Xid from timestamp. On a millisecond scale it is possible that same Xid is generated more than once.

           

          Wrong on both counts. They don't contain a timestamp for the start of the tx, because calling into the kernel to get the time is too expensive. They do contain the time the process was initialized, because that's a one off cost.  They also contain a sequence number. Read Uid.java and stop talking nonsense.

          • 2. Re: JBoss default Xid generator
            girish_n

            When Does JBoss throw below exception?

             

            SEVERE [com.sun.genericjmsra] (WorkManager(2)-95) After delivery failed javax.transaction.RollbackException: [com.arjuna.ats.internal

            .jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Could not commit transaction.

            javax.resource.ResourceException: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats

            .internal.jta.transaction.arjunacore.commitwhenaborted] Could not commit transaction.

                    at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.after(MessageInflowLocalProxy.java:263)

                    at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:140)

                    at $Proxy118.afterDelivery(Unknown Source)

                    at com.sun.genericra.inbound.async.InboundJmsResource.releaseEndpoint(InboundJmsResource.java:313)

                    at com.sun.genericra.inbound.async.WorkImpl.run(WorkImpl.java:115)

                    at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)

                    at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

                    at java.lang.Thread.run(Thread.java:679)

            Caused by: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transacti

            on.arjunacore.commitwhenaborted] Could not commit transaction.

                    at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1443)

                    at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:137)

                    at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)

                    at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.endTransaction(MessageInflowLocalProxy.java:464)

                    at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.finish(MessageInflowLocalProxy.java:343)

                    at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.after(MessageInflowLocalProxy.java:259)

                    ... 9 more

            • 3. Re: JBoss default Xid generator
              jhalliday

              What's that got to do with the Xid generator? That's the JCA tx inflow API you're using. Which means the Xid is being externally supplied and the subordinate tx mgr will use it verbatim as the spec requires.

              • 4. Re: JBoss default Xid generator
                girish_n

                Hi Jonathan, Thanks for the info.

                 

                I have few questions:

                Who will call XAResource.start()? I believe it is JBoss -> Resource Adapter -> JMS Provider ?

                Will JBoss pass null XID to start() in any case? If so when? How is JMS Provider expected to deal with it?