I'm using GeronimoTransactionManager with Jencks 1.2, ActiveMQ 4.0 and a third-party XA capable database.
What I'm seeing is during the prepare phase of the commit the third-party database XAResource is throwing an XAException which causes the TransactionManager to roll back the transaction.
It appears that the TransactionManager seems to be getting confused during the course of the rollback.
I can see that TransactionImpl.commit detected the failure, set it's status to STATUS_MARKED_ROLLBACK, rolled back the remaining resource then threw a RollbackException.
Before this the jvm goes to unwind the stack it calls the finally of TransactionImpl.commit which sets the status to STATUS_NO_TRANSACTION.
InheritableTransactionContext.complete catches this exception as Throwable then calls rollbackAndThrow.
rolllbackAndThrow seems to get into trouble by calling rollback on the transaction which is also STATUS_NO_TRANSACTION.
This is where it throws an IllegalStateException becausee rollback was called on something that no longer had a transaction in process.
Am I missing something in the config of the TransactionManager?
As I read this blow-by-blow I come to realize that rollbackAndThrow is attempting to roll back a transaction that is already cleaned up. Should I just add a check if that transaction has been cleaned up before it calls rollback on it? It just looks like the transaction has been rolled back and has been asked to roll back again.
Any suggestions on workarounds or a compatible version where this is fixed would be appreciated.