Christian Schneider
Christian Schneider

Reputation: 19626

Exception "Unable to commit: transaction marked for rollback" when using camel-jpa and JTA Transactions

I am currently working on a Tutorial to show camel-jpa on Karaf together with JTA Transactions. I use the following route:

from("jpa://net.lr.tutorial.karaf.camel.jpa2jms.model.Person").id("jpa2jms") .transacted() .marshal(df) .bean(new ExceptionDecider()) .to("jms:person");

So I checked if the transactions work by throwing an exception in ExceptionDecider. When I do this I get the following Exception:

https://gist.github.com/3150591

Any ideas what I do wrong? I suspect it might be the way I setup the transaction manager. You can find my whole project on github: https://github.com/cschneider/Karaf-Tutorial/tree/master/cameljpa/jpa2jms

Upvotes: 1

Views: 1177

Answers (1)

Walter Stone
Walter Stone

Reputation: 76

This happens when the transaction is marked inside an exception handler but the exception is swallowed. Normally such exceptions should bubble up and cause the whole transaction to rollback.

If the exception is swallowed instead then camel tries to commit at the end which results in the above exception.

Upvotes: 4

Related Questions