Question

JTA transaction unexpectedly rolled back (maybe due to a timeout); the nested exception is

javax.transaction.RollbackException: The transaction was set to rollback only

I get an timeout exception due to JPA: how can I increase the time needed for the transaction?

Where should I include the parameter to resolve this?

I am using tomcat 7.

Was it helpful?

Solution

The parameter that you want to change is the maximum timeout for your JTA transaction.

If you're using Atomikos (which I believe is what most people use with Tomcat), you can set that via the com.atomikos.icatch.max_timeout property or via the com.atomikos.icatch.default_jta_timeout property. This property can be set either via a JVM command line parameter, or via Spring Integration (described here).

More information about the configuration (JTA) properties for Atomikos can be found here.

If you're using Bitronix, you can add a bitronix-default-config.properties file to your classpath, and then add a bitronix.tm.timer.defaultTransactionTimeout=<value> line to that file. See here for more info.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top