as mentioned in the reference manual I have configured my command-bus with a transaction-manager (Spring) - <axon:command-bus id=“commandBus” transaction-manager=“transactionManager”/>.
Now when during the commit an exception arises - e.g. a ConstraintViolationException - Spring catches that exception and performs a rollback. Then the exception is thrown again and catched by Axon which also triggers a rollback and tells the transaction-manager to rollback. That leads to a IllegalTransactionStateException because the transaction is already marked as completed because of the first rollback.
First rollback is triggered in org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit() via doRollbackOnCommitException().
Second rollback is triggered in org.axonframework.unitofwork.NestableUnitOfWork.commit() calling org.axonframework.unitofwork.DefaultUnitOfWork.doRollback() which calls transactionManager.rollbackTransaction() resulting in AbstractPlatformTransactionManager.rollback() which throws the mentioned IllegalTransactionStateException.
Do I do anything wrong or is this a bug?