strange transaction rollback error

I am getting the following stack in the log, as near as I can tell, apparently indicating an issue the transaction surrounding the snapshot generation. However, when I inspect Mongo, all data appears to have been persisted (both events and snapshots). Here is the stack:

5-04-26 12:54:36,846 [pool-1-thread-1] DEBUG - Notifying listeners of transaction commit request
2015-04-26 12:54:36,846 [pool-1-thread-1] DEBUG - Notifying listener [org.axonframework.eventsourcing.EventSourcingRepository$ConflictResolvingListener] of upcoming transaction commit
2015-04-26 12:54:36,846 [pool-1-thread-1] DEBUG - Notifying listener [org.axonframework.repository.LockingRepository$LockCleaningListener] of upcoming transaction commit
2015-04-26 12:54:36,846 [pool-1-thread-1] DEBUG - Notifying listener [org.axonframework.eventsourcing.EventCountSnapshotterTrigger$SnapshotTriggeringListener] of upcoming transaction commit
2015-04-26 12:54:36,846 [pool-1-thread-1] DEBUG - Listeners successfully notified
2015-04-26 12:54:36,847 [pool-1-thread-1] WARN com.arjuna.ats.arjuna - ARJUNA012077: Abort called on already aborted atomic action 0:ffff7f000001:c732:553d422b:3
2015-04-26 12:54:36,852 [pool-1-thread-1] DEBUG - An error occurred while committing this UnitOfWork. Performing rollback…
org.springframework.transaction.UnexpectedRollbackException: JTA transaction already rolled back (probably due to a timeout)
at org.springframework.transaction.jta.JtaTransactionManager.doCommit( ~[spring-tx-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at ~[spring-tx-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at ~[spring-tx-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.axonframework.unitofwork.SpringTransactionManager.commitTransaction( ~[axon-core-2.4.jar:2.4]
at org.axonframework.unitofwork.SpringTransactionManager.commitTransaction( ~[axon-core-2.4.jar:2.4]
at org.axonframework.unitofwork.DefaultUnitOfWork.doCommit( ~[axon-core-2.4.jar:2.4]
at org.axonframework.unitofwork.NestableUnitOfWork.commit( ~[axon-core-2.4.jar:2.4]
at org.axonframework.commandhandling.SimpleCommandBus.doDispatch( [axon-core-2.4.jar:2.4]
at org.axonframework.commandhandling.SimpleCommandBus.doDispatch( [axon-core-2.4.jar:2.4]
at org.axonframework.commandhandling.AsynchronousCommandBus.access$001( [axon-core-2.4.jar:2.4]
at org.axonframework.commandhandling.AsynchronousCommandBus$ [axon-core-2.4.jar:2.4]
at java.util.concurrent.ThreadPoolExecutor.runWorker( [na:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$ [na:1.7.0_75]
at [na:1.7.0_75]

And here is the relevant section of the Spring configuration:

${} domainEvents snapshotEvents

<axon:snapshotter id=“axonSnapshotter”

${jta.defaultTimeout} ${jta.objectStoreDir} ${jta.objectStoreDir}

<tx:annotation-driven transaction-manager=“transactionManager”/>

I’ve set the transaction default timeout to 900 sec (in an external property file). Has anyone encountered anything like this?


Hi Michael,

apparently, some component along the line decides that the current transaction needs to be rolled back. There is a “rollbackOnly” flag on the transaction object. You’ll have to figure out which components sets it to “true”.

As far as I know (and this may be based on outdated information), MongoDB doesn’t support transactions. Therefore, all data will be persisted to Mongo, regardless of the result of the surrounding transaction.



Thanks, Allard. I found the problem.

First, you are right. I had a transaction manager set for the snapshotter, and that clearly is unnecessary in my case, since it’s persisting to Mongo.

But the problem was actually that the transaction was timing out due to a misconfiguration of the Spring PlatformTransactionManager. I had thought that setting the default timeout in the system properties was enough, but apparently, I need to do this:

<bean id=“transactionManager” class=“org.springframework.transaction.jta.JtaTransactionManager”

Obviously, nothing to do with Axiom, but hopefully will help someone else out there.