I'm getting a ConcurrentModificationException:
Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1212) [narayana-jts-idlj-5.0.4.Final.
jar:5.0.4.Final (revision: b4060)]
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126) [narayana-jts-idlj-5.0.4.Final.jar:5.0.4.Final (r
evision: b4060)]
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:91) [wildfly-ejb3-9.0.0.CR1.jar:9.0.0.CR1]
... 111 more
Caused by: javax.persistence.PersistenceException: error during managed flush
at org.hibernate.jpa.spi.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1887) [hibernate-en
titymanager-4.3.9.Final.jar:4.3.9.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackC
oordinatorNonTrackingImpl.java:119) [hibernate-core-4.3.9.Final.jar:4.3.9.Final]
at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:50) [hibernate-co
re-4.3.9.Final.jar:4.3.9.Final]
at org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList.beforeCompletion(JCAOrderedLastSynchronizationList.java:116)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76) [narayana-jts-idlj-5.0.4.Final.j
ar:5.0.4.Final (revision: b4060)]
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:371) [narayana-jts-idlj-5.0.4.Final.jar:5.0.4.Final (
revision: b4060)]
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91) [narayana-jts-idlj-5.0.4.Final.jar:5.0.4.Final (revision: b406
0)]
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162) [narayana-jts-idlj-5.0.4.Final.jar:5.0.4.Final (revision: b4060)]
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1200) [narayana-jts-idlj-5.0.4.Final.
jar:5.0.4.Final (revision: b4060)]
... 114 more
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) [rt.jar:1.8.0_45]
at java.util.ArrayList$Itr.next(ArrayList.java:851) [rt.jar:1.8.0_45]
at java.util.Collections$UnmodifiableCollection$1.next(Collections.java:1042) [rt.jar:1.8.0_45]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:463) [hibernate-core-4.3.9.Final.jar:4.3.9.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:351) [hibernate-core-4.3.9.Final.jar:4.3.9.Final]
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350) [hibernate-core-4.3.9.Final.jar:
4.3.9.Final]
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56) [hibernate-core-4.3.9.Final.jar:4.3.9.Final]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1258) [hibernate-core-4.3.9.Final.jar:4.3.9.Final]
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:425) [hibernate-core-4.3.9.Final.jar:4.3.9.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackC
oordinatorNonTrackingImpl.java:114) [hibernate-core-4.3.9.Final.jar:4.3.9.Final]
... 121 more
That happens when I've a post-persist entity-listener defined like so:
<entity class="somepackage.db.entities.SomeEntity">
<entity-listeners>
<entity-listener class="somepackage.ejb.jpa.SomeEntityListener">
<post-persist method-name="onPrePersist"/>
<post-update method-name="onPrePersist"/>
</entity-listener>
</entity-listeners>
</entity>
And inside that EntityListener I create a new (different Entity) and persist it. AutoFlushMode is AUTO. I don't see why this shouldn't be possible?!
I'd try to get a simplified test case running for you, but I can't import the hibernate-orm package into intellij. I even tried a fix via vi, but I couldn't get the gradle to build the 4.3 branch:
script '/Users/tbecker/Documents/workspaces/hibernate-orm/source-generation.gradle': 16: unable to resolve class org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler
@ line 16, column 1.
import org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler
Tried jdk1.7 and 1.8 without success on osx. Will give it another try tomorrow maybe.
|