I tried to create my datasource in the JBOSS AS itself then modify my persistence.xml accordingly
again, 1 call in 1 thread is all fine, but when I got two call from two threads concurrently, I got this error
14:18:48,407 WARN [com.arjuna.ats.arjuna] (pool-19-thread-1) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffac107acb:-ed1e439:51beb786:9e, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@2c6c1215 >: javax.persistence.PersistenceException: org.hibernate.HibernateException: Flush during cascade is dangerous
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1377) [hibernate-entitymanager-4.1.9.Final.jar:4.1.9.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1300) [hibernate-entitymanager-4.1.9.Final.jar:4.1.9.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1306) [hibernate-entitymanager-4.1.9.Final.jar:4.1.9.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1500) [hibernate-entitymanager-4.1.9.Final.jar:4.1.9.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:109) [hibernate-core-4.1.9.Final.jar:4.1.9.Final]
at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53) [hibernate-core-4.1.9.Final.jar:4.1.9.Final]
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:164)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:117)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:167)
at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1010) [spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) [spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) [spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:387) [spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120) [spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) [spring-aop-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) [spring-aop-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at $Proxy257.runTest3(Unknown Source) at app.chameleon.core.taskmanagement.backend.controller.TestSpringAndJbpmController$2.run(TestSpringAndJbpmController.java:179) [classes:]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_11]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_11]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_11]
Caused by: org.hibernate.HibernateException: Flush during cascade is dangerous
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1209) [hibernate-core-4.1.9.Final.jar:4.1.9.Final]
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:402) [hibernate-core-4.1.9.Final.jar:4.1.9.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:104) [hibernate-core-4.1.9.Final.jar:4.1.9.Final]
... 23 more
14:18:48,407 INFO [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (pool-19-thread-1) HHH000106: Forcing container resource cleanup on transaction completion
14:18:48,829 WARN [org.hibernate.engine.jdbc.internal.JdbcResourceRegistryImpl] (pool-19-thread-2) HHH000387: ResultSet's statement was not registered
14:18:48,829 ERROR [stderr] (pool-19-thread-1) org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
14:18:48,829 INFO [stdout] (pool-19-thread-2) Finish 1, 2013-06-17 14:1848.829
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1013)
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:387)
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at $Proxy257.runTest3(Unknown Source)
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at app.chameleon.core.taskmanagement.backend.controller.TestSpringAndJbpmController$2.run(TestSpringAndJbpmController.java:179)
14:18:48,829 ERROR [stderr] (pool-19-thread-1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at java.lang.Thread.run(Thread.java:722)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1177)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:117)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:167)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1010)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) ... 13 more
14:18:48,845 ERROR [stderr] (pool-19-thread-1) Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Flush during cascade is dangerous
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1377)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1300)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1306)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1500)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:109)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:164)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) ... 17 more
14:18:48,845 ERROR [stderr] (pool-19-thread-1) Caused by: org.hibernate.HibernateException: Flush during cascade is dangerous
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1209)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:402)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:104)
14:18:48,845 ERROR [stderr] (pool-19-thread-1) ... 23 more