5 Replies Latest reply: Mar 31, 2010 8:18 AM by Adrian Brock RSS

MDB - JCA Transaction issue

srinivaas venkat Novice

HI, I have an issue with JCA transactions while sending the reply message from MDB. I' ve already posted this in Hornetq forum (by mistake) and this is the URL. Can you pls help?

 

https://community.jboss.org/message/532762

 

Thanks

Srinivaas

  • 1. Re: MDB - JCA Transaction issue
    Adrian Brock Master

    "

    14:03:04,783 ERROR [STDERR] javax.transaction.SystemException: TransactionImple.enlistResource - XAResource.start [com.arjuna.ats.internal.jta.transaction.arjunacore.couldnotregister] [com.arjuna.ats.internal.jta.transaction.arjunacore.couldnotregister] could not register transaction: < 131075, 27, 25, 49454553511011004849515658551004958529897491015052101585110045535110110048495156585510049585298974910150521015855101 >
    14:03:04,783 ERROR [STDERR]  at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:870)
    14:03:04,783 ERROR [STDERR]  .

    "

     

    This says that XAResource.start() threw an error, but you don't post what that error was.

  • 2. Re: MDB - JCA Transaction issue
    srinivaas venkat Novice

    Adrain, pls find the log file attached,

     

    I'm a newbie to JCA/ JMS, basically I've an MDB that connects to node1 and picks the request and sends the response message back to same node1 and in case if that fails (due to network error or carsh) then the MDB should connect to another node (node2) to send the response message.

     

    But since i'm using CMT and Transaction as REQUIRED, I would like to know if it is possible for the mdb to connect to node2 for sending the response message when it cant connect to node1? In this case how will the acknowledgment be sent from MDB to node1 to avoid request message redelivery?

     

    Thanks,

    Srinivaas

     

    Message was edited by: srinivaas venkat, Updated the log file

  • 3. Re: MDB - JCA Transaction issue
    Adrian Brock Master

    The error message says it can't enlist the connection in the transaction because

    something has set the transaction to rollback only.

     

    10:07:42,812 ERROR [HornetQRASessionFactoryImpl] Could not create session
    javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -53edf53a:5e0:4ba99350:a3 status: ActionStatus.ABORT_ONLY
    >
            at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:370)
            at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
            at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
            at org.hornetq.ra.HornetQRASessionFactoryImpl.allocateConnection(HornetQRASessionFactoryImpl.java:837)
            at org.hornetq.ra.HornetQRASessionFactoryImpl.createSession(HornetQRASessionFactoryImpl.java:470)
            at wipo.csc.jms.cluster.ejb.ClusteredQueueEJBListener.sendMessage(ClusteredQueueEJBListener.java:135)

     

    So you need to find out what is doing setRollbackOnly() on the transaction.

    e.g. invoking a CMT EJB in the same transaction that throws a RuntimeException would do that.

     

    Nothing in JCA ever sets the status of the transaction to rollback only.

  • 4. Re: MDB - JCA Transaction issue
    srinivaas venkat Novice

    Adrian, Thanks for your quick response,

     

    After enabling trace I could see that the transaction was set to RollbackOnly when an exception occurs while connecting to node1 (because of the temporary network failure). I'm using Hornetq jca adapter to connect the mdb to queue nodes.

     

    Is it because the execption thrown (after attempting to connect to node1) is a system exception that the transaction is set to rollbackOnly? If that is the case is it not possible to send the message to node2 even after getting an exception (while connecting to node1) with the transaction type set to REQUIRED?

     

    If I use Transaction as NOT_SUPPORTED or BMT everything works fine but is it not possible with CMT/transaction as REQUIRED? Pls help!

     

    I've also attached the log file showing the transaction rollback status before and after exception.

  • 5. Re: MDB - JCA Transaction issue
    Adrian Brock Master

    It looks to me like hornetq is returning the wrong error code?

    So you'd be better off moving your discussion to that forum.

     

    XAER_RMERR is for a resource error inside the transaction, meaning

    the transaction is in unknown state and can't be committed.

     

    I think it should be using XAER_RMFAIL if the problem is a failure to enlist?

    But ask in the transactions forum what the correct code should be,

    since they are the ones that interpret them.