BTM+SWITFMQ - commit does not fail when XAER_NOTA exception

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

BTM+SWITFMQ - commit does not fail when XAER_NOTA exception

jkuchta
Hi,

I am running application where BTM 2.1.0 orchestrates SwiftMq JMS router and Oracle database. From time to time I can see in the log that JMS router reports XAException: java.lang.Exception: Xid not found. Stacktrace snippet is bellow. The full trace of the given transaction can be found in the attached log file.

The thing is that JMS router does not consider the transaction successful even though the BTM does (all database changes get commited). The failed message is redelivered again, which causes problems cause the messages has been processed before and related data committed into database.

Can you please shed some light on the problem? Why the transaction is committed when there is an exception during the commit? Thanks for any feedback.

2011-03-03 18:20:02.278 DEBUG [SRRoute-3] () bitronix.tm.BitronixTransaction - transaction status is changing from PREPARED to COMMITTING - executing 0 listener(s)
2011-03-03 18:20:02.278 DEBUG [SRRoute-3] () bitronix.tm.twopc.AbstractPhaseEngine - executing phase on 2 resource(s) enlisted in 1 position(s) in reverse position order
2011-03-03 18:20:02.278 DEBUG [SRRoute-3] () bitronix.tm.twopc.AbstractPhaseEngine - running 2 job(s) for position '1'
2011-03-03 18:20:02.278 DEBUG [SRRoute-3] () bitronix.tm.twopc.Committer - committing resource an XAResourceHolderState with uniqueName=ImpDB XAResource=oracle.jdbc.driver.T4CXAResource@1fb911a (ended) with XID a Bitronix XID [696D702D636F72652D62746D0000012E7CBBBC8800027FDD : 696D702D636F72652D62746D0000012E7CBBBCE200027FE7]
2011-03-03 18:20:02.406 DEBUG [SRRoute-3] () bitronix.tm.twopc.Committer - committed resource an XAResourceHolderState with uniqueName=ImpDB XAResource=oracle.jdbc.driver.T4CXAResource@1fb911a (ended) with XID a Bitronix XID [696D702D636F72652D62746D0000012E7CBBBC8800027FDD : 696D702D636F72652D62746D0000012E7CBBBCE200027FE7]
2011-03-03 18:20:02.406 DEBUG [SRRoute-3] () bitronix.tm.twopc.Committer - committing resource an XAResourceHolderState with uniqueName=ImpJMS XAResource=com.swiftmq.jms.v750.XAResourceImpl@52744 (ended) with XID a Bitronix XID [696D702D636F72652D62746D0000012E7CBBBC8800027FDD : 696D702D636F72652D62746D0000012E7CBBBC8A00027FDF]
2011-03-03 18:20:02.416 WARN  [SRRoute-3] () bitronix.tm.twopc.Committer - resource 'ImpJMS' reported XAER_NOTA when asked to commit transaction branch. Transaction is prepared and will commit via recovery service when resource availability allows.
javax.transaction.xa.XAException: java.lang.Exception: Xid not found.
        at com.swiftmq.jms.v750.XAResourceImpl.commit(Unknown Source)
        at bitronix.tm.twopc.Committer$CommitJob.commitResource(Committer.java:194)
        at bitronix.tm.twopc.Committer$CommitJob.execute(Committer.java:183)
        at bitronix.tm.twopc.executor.Job.run(Job.java:70)
        at bitronix.tm.twopc.executor.SyncExecutor.submit(SyncExecutor.java:31)
        at bitronix.tm.twopc.AbstractPhaseEngine.runJobsForPosition(AbstractPhaseEngine.java:129)
        at bitronix.tm.twopc.AbstractPhaseEngine.executePhase(AbstractPhaseEngine.java:90)
        at bitronix.tm.twopc.Committer.commit(Committer.java:82)
        at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:235)
        at bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:120)
        at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1009)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java
:1058)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.
java:1050)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
        at java.lang.Thread.run(Thread.java:619)
2011-03-03 18:20:02.418 DEBUG [SRRoute-3] () bitronix.tm.twopc.AbstractPhaseEngine - phase executed with 0 exception(s)
2011-03-03 18:20:02.418 DEBUG [SRRoute-3] () bitronix.tm.twopc.AbstractPhaseEngine - ran 2 job(s) for position '1'
2011-03-03 18:20:02.418 DEBUG [SRRoute-3] () bitronix.tm.twopc.Committer - phase 2 commit executed on resources [ImpDB]
2011-03-03 18:20:02.418 DEBUG [SRRoute-3] () bitronix.tm.twopc.Committer - phase 2 commit succeeded on resources [ImpDB]
2011-03-03 18:20:02.418 DEBUG [SRRoute-3] () bitronix.tm.BitronixTransaction - changing transaction status to COMMITTED
Reply | Threaded
Open this post in threaded view
|

Re: BTM+SWITFMQ - commit does not fail when XAER_NOTA exception

jkuchta
Attached full trace of the troubled transaction.
Reply | Threaded
Open this post in threaded view
|

Re: BTM+SWITFMQ - commit does not fail when XAER_NOTA exception

jkuchta
In reply to this post by jkuchta
Problem solved. My mistake. We are running several application instances against a single datasource (SwiftMQ JMS router) and all the application instances were using the same BTM serverId. When the serverIds were made unique the problem disappeared.

Detailed explanation is in BTM documentation:
http://docs.codehaus.org/display/BTM/ImplementationDetails#ImplementationDetails-currentNodeOnlyRecovery