Created
June 25, 2014 01:48
-
-
Save scottmarlow/63c4ab686368853d759b to your computer and use it in GitHub Desktop.
Show TransactionJoinedToMultipleThreadsTest "Transaction was rolled back in a different thread!" exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javax.persistence.PersistenceException: org.hibernate.HibernateException: Transaction was rolled back in a different thread! | |
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763) | |
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677) | |
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1771) | |
at org.hibernate.jpa.internal.EntityManagerImpl.isOpen(EntityManagerImpl.java:170) | |
at org.hibernate.jpa.internal.EntityManagerImpl.checkOpen(EntityManagerImpl.java:101) | |
at org.hibernate.jpa.internal.EntityManagerImpl.checkOpen(EntityManagerImpl.java:96) | |
at org.hibernate.jpa.internal.EntityManagerImpl.close(EntityManagerImpl.java:148) | |
at org.hibernate.jpa.test.transaction.TransactionJoinedToMultipleThreadsTest.testTransactionRolledBackInDifferentThreadFailure(TransactionJoinedToMultipleThreadsTest.java:143) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) | |
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) | |
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) | |
at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:62) | |
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) | |
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) | |
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) | |
at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74) | |
Caused by: org.hibernate.HibernateException: Transaction was rolled back in a different thread! | |
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorTrackingImpl.processAnyDelayedAfterCompletion(SynchronizationCallbackCoordinatorTrackingImpl.java:100) | |
at org.hibernate.internal.SessionImpl.delayedAfterCompletion(SessionImpl.java:664) | |
at org.hibernate.internal.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:2157) | |
at org.hibernate.internal.SessionImpl.isOpen(SessionImpl.java:404) | |
at org.hibernate.jpa.internal.EntityManagerImpl.isOpen(EntityManagerImpl.java:165) | |
... 16 more |
Hi,
hi ,could you send me the source code of TransactionJoinedToMultipleThreadsTest
how we can get the org.hibernate.HibernateException: Transaction was rolled back in a different thread!
thanks a lot
scottmarlow/hibernate-orm@d7fa2c9 contains the test source code for TransactionJoinedToMultipleThreadsTest
, sorry that I didn't add the response until now. I missed the notification of the question years ago.
Hi, How to fix this issue "Transaction was rolled back in a different thread!"
"hibernate.jta.track_by_thread" defaults to true but you can set to false to disable.
More details pasted from Hibernate ORM 5.3 branch org.hibernate.cfg.AvailableSettings:
/**
* A transaction can be rolled back by another thread ("tracking by thread")
* -- not the original application. Examples of this include a JTA
* transaction timeout handled by a background reaper thread. The ability
* to handle this situation requires checking the Thread ID every time
* Session is called. This can certainly have performance considerations.
*
* Default is <code>true</code> (enabled).
*/
String JTA_TRACK_BY_THREAD = "hibernate.jta.track_by_thread";
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, How to fix this issue "Transaction was rolled back in a different thread!"