org.hibernate.TransactionException: Could not register synchronization for container transaction

Hibernate JIRA | Adrian Pillinger | 9 years ago
  1. 0

    I am running within JBoss inside an EJB using container managed transactions. The transaction is running and my hibernate post-insert event listener gets fired. Within this post-insert event listener I am creating a new session and calling beginTransaction() in order to make further database updates in new session, but inside the same JTA transaction. The begin transaction fails to synchronise with the current JTA transaction but there seems to be no apparent reason as to why this would fail. The listener code causing the problem is... Session newSession = event.getPersister().getFactory().openSession(); newSession.beginTransaction(); On the begin transaction call the exception thrown is 10:56:52,803 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session org.hibernate.TransactionException: Could not register synchronization for container transaction at org.hibernate.transaction.CMTTransaction.begin(CMTTransaction.java:45) at org.hibernate.ejb.transaction.JoinableCMTTransaction.begin(JoinableCMTTransaction.java:70) at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326) at com.dolby.persist.listener.trigger.AuditTrigger.audit(AuditTrigger.java:67) at com.dolby.persist.listener.trigger.AuditTrigger.fireAfterUpdateTrigger(AuditTrigger.java:293) at com.dolby.persist.listener.trigger.TriggerEventListener.onPostUpdate(TriggerEventListener.java:522) at org.hibernate.action.EntityUpdateAction.postUpdate(EntityUpdateAction.java:180) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:159) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1562) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305) at com.dolby.persist.dao.hibernate.GenericHibernateFinderDAO.findById(GenericHibernateFinderDAO.java:250) at com.dolby.persist.dao.hibernate.GenericHibernateCrudDAO.merge(GenericHibernateCrudDAO.java:112) at com.dolby.pics.core.ejb.bean.impl.InventoryBean.save(InventoryBean.java:99) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) at com.dolby.pics.core.ejb.bean.impl.DefaultInterceptor.log(DefaultInterceptor.java:36) at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118) at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79) at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278) at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106) at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165) 10:56:52,804 ERROR [GenericHibernateCrudDAO] Hibernate Exception org.hibernate.TransactionException: Could not register synchronization for container transaction at org.hibernate.transaction.CMTTransaction.begin(CMTTransaction.java:45) at org.hibernate.ejb.transaction.JoinableCMTTransaction.begin(JoinableCMTTransaction.java:70) at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326) at com.dolby.persist.listener.trigger.AuditTrigger.audit(AuditTrigger.java:67) at com.dolby.persist.listener.trigger.AuditTrigger.fireAfterUpdateTrigger(AuditTrigger.java:293) at com.dolby.persist.listener.trigger.TriggerEventListener.onPostUpdate(TriggerEventListener.java:522) at org.hibernate.action.EntityUpdateAction.postUpdate(EntityUpdateAction.java:180) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:159) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1562) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305) at com.dolby.persist.dao.hibernate.GenericHibernateFinderDAO.findById(GenericHibernateFinderDAO.java:250) at com.dolby.persist.dao.hibernate.GenericHibernateCrudDAO.merge(GenericHibernateCrudDAO.java:112) at com.dolby.pics.core.ejb.bean.impl.InventoryBean.save(InventoryBean.java:99) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) at com.dolby.pics.core.ejb.bean.impl.DefaultInterceptor.log(DefaultInterceptor.java:36) at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118) at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79) at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278) at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106) at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165) 10:56:52,823 ERROR [DefaultInterceptor] An error occured executing: com.dolby.pics.core.ejb.bean.impl.InventoryBean.save([Ljava.lang.Object;@5c96bfda) com.dolby.pics.core.ejb.SaveFailedException: Could not register synchronization for container transaction at com.dolby.pics.core.ejb.bean.impl.InventoryBean.save(InventoryBean.java:113) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) at com.dolby.pics.core.ejb.bean.impl.DefaultInterceptor.log(DefaultInterceptor.java:36) at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118) at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79) at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278) at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106) at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)

    Hibernate JIRA | 9 years ago | Adrian Pillinger
    org.hibernate.TransactionException: Could not register synchronization for container transaction
  2. 0

    I am running within JBoss inside an EJB using container managed transactions. The transaction is running and my hibernate post-insert event listener gets fired. Within this post-insert event listener I am creating a new session and calling beginTransaction() in order to make further database updates in new session, but inside the same JTA transaction. The begin transaction fails to synchronise with the current JTA transaction but there seems to be no apparent reason as to why this would fail. The listener code causing the problem is... Session newSession = event.getPersister().getFactory().openSession(); newSession.beginTransaction(); On the begin transaction call the exception thrown is 10:56:52,803 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session org.hibernate.TransactionException: Could not register synchronization for container transaction at org.hibernate.transaction.CMTTransaction.begin(CMTTransaction.java:45) at org.hibernate.ejb.transaction.JoinableCMTTransaction.begin(JoinableCMTTransaction.java:70) at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326) at com.dolby.persist.listener.trigger.AuditTrigger.audit(AuditTrigger.java:67) at com.dolby.persist.listener.trigger.AuditTrigger.fireAfterUpdateTrigger(AuditTrigger.java:293) at com.dolby.persist.listener.trigger.TriggerEventListener.onPostUpdate(TriggerEventListener.java:522) at org.hibernate.action.EntityUpdateAction.postUpdate(EntityUpdateAction.java:180) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:159) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1562) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305) at com.dolby.persist.dao.hibernate.GenericHibernateFinderDAO.findById(GenericHibernateFinderDAO.java:250) at com.dolby.persist.dao.hibernate.GenericHibernateCrudDAO.merge(GenericHibernateCrudDAO.java:112) at com.dolby.pics.core.ejb.bean.impl.InventoryBean.save(InventoryBean.java:99) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) at com.dolby.pics.core.ejb.bean.impl.DefaultInterceptor.log(DefaultInterceptor.java:36) at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118) at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79) at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278) at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106) at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165) 10:56:52,804 ERROR [GenericHibernateCrudDAO] Hibernate Exception org.hibernate.TransactionException: Could not register synchronization for container transaction at org.hibernate.transaction.CMTTransaction.begin(CMTTransaction.java:45) at org.hibernate.ejb.transaction.JoinableCMTTransaction.begin(JoinableCMTTransaction.java:70) at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326) at com.dolby.persist.listener.trigger.AuditTrigger.audit(AuditTrigger.java:67) at com.dolby.persist.listener.trigger.AuditTrigger.fireAfterUpdateTrigger(AuditTrigger.java:293) at com.dolby.persist.listener.trigger.TriggerEventListener.onPostUpdate(TriggerEventListener.java:522) at org.hibernate.action.EntityUpdateAction.postUpdate(EntityUpdateAction.java:180) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:159) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1562) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305) at com.dolby.persist.dao.hibernate.GenericHibernateFinderDAO.findById(GenericHibernateFinderDAO.java:250) at com.dolby.persist.dao.hibernate.GenericHibernateCrudDAO.merge(GenericHibernateCrudDAO.java:112) at com.dolby.pics.core.ejb.bean.impl.InventoryBean.save(InventoryBean.java:99) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) at com.dolby.pics.core.ejb.bean.impl.DefaultInterceptor.log(DefaultInterceptor.java:36) at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118) at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79) at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278) at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106) at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165) 10:56:52,823 ERROR [DefaultInterceptor] An error occured executing: com.dolby.pics.core.ejb.bean.impl.InventoryBean.save([Ljava.lang.Object;@5c96bfda) com.dolby.pics.core.ejb.SaveFailedException: Could not register synchronization for container transaction at com.dolby.pics.core.ejb.bean.impl.InventoryBean.save(InventoryBean.java:113) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) at com.dolby.pics.core.ejb.bean.impl.DefaultInterceptor.log(DefaultInterceptor.java:36) at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118) at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79) at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278) at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106) at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)

    Hibernate JIRA | 9 years ago | Adrian Pillinger
    org.hibernate.TransactionException: Could not register synchronization for container transaction
  3. 0

    Hibernate Search and Lucene - Creating index throwing Synchronization Error

    Stack Overflow | 6 years ago | Vijay
    org.hibernate.TransactionException: Could not register synchronization for container transaction
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    If a mass indexer is used inside a CMP bean in JBoss 6 to rebuild the search index, an org.hibernate.TransactionException is thrown: {noformat} 2010-12-06 14:01:30,720 ERROR [org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer] (Hibernate Search: collectionsloader-1) error during batch indexing: : org.hibernate.TransactionException: Could not register synchronization for container transaction at org.hibernate.transaction.CMTTransaction.begin(CMTTransaction.java:76) [:3.6.0.Final] at org.hibernate.ejb.transaction.JoinableCMTTransaction.begin(JoinableCMTTransaction.java:89) [:3.6.0.Final] at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1473) [:3.6.0.Final] at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.run(EntityConsumerLuceneworkProducer.java:90) [:3.3.0.CR1] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_20] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_20] at java.lang.Thread.run(Thread.java:619) [:1.6.0_20] {noformat} I've included an example EAR (see attachment) that can be deployed to JBoss 6.0.0.CR1 without any modifications. It contains the required hibernate search libraries and defines one single indexed entity bean {{Contact}} as well as a JBoss service EJB named {{at.mw.contacts:ContactsService}} that can be accessed via JMX console. Use this service to do one of the following things: * add new contacts by specifying firstName/lastName * list all contacts * search for contacts using the search index * rebuild the entire search index (using a MassIndexer) Rebuilding the index fails with the exception listed above. Sources included. (the example uses an in-memory HSQL-DB and the ram directory provider for the lucene index). (see also forum discussion: [Could not register synchronization for container transaction|https://forum.hibernate.org/viewtopic.php?f=9&t=1004515&start=0])

    Hibernate JIRA | 6 years ago | Mario Winterer
    org.hibernate.TransactionException: Could not register synchronization for container transaction
  6. 0

    If a mass indexer is used inside a CMP bean in JBoss 6 to rebuild the search index, an org.hibernate.TransactionException is thrown: {noformat} 2010-12-06 14:01:30,720 ERROR [org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer] (Hibernate Search: collectionsloader-1) error during batch indexing: : org.hibernate.TransactionException: Could not register synchronization for container transaction at org.hibernate.transaction.CMTTransaction.begin(CMTTransaction.java:76) [:3.6.0.Final] at org.hibernate.ejb.transaction.JoinableCMTTransaction.begin(JoinableCMTTransaction.java:89) [:3.6.0.Final] at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1473) [:3.6.0.Final] at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.run(EntityConsumerLuceneworkProducer.java:90) [:3.3.0.CR1] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_20] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_20] at java.lang.Thread.run(Thread.java:619) [:1.6.0_20] {noformat} I've included an example EAR (see attachment) that can be deployed to JBoss 6.0.0.CR1 without any modifications. It contains the required hibernate search libraries and defines one single indexed entity bean {{Contact}} as well as a JBoss service EJB named {{at.mw.contacts:ContactsService}} that can be accessed via JMX console. Use this service to do one of the following things: * add new contacts by specifying firstName/lastName * list all contacts * search for contacts using the search index * rebuild the entire search index (using a MassIndexer) Rebuilding the index fails with the exception listed above. Sources included. (the example uses an in-memory HSQL-DB and the ram directory provider for the lucene index). (see also forum discussion: [Could not register synchronization for container transaction|https://forum.hibernate.org/viewtopic.php?f=9&t=1004515&start=0])

    Hibernate JIRA | 6 years ago | Mario Winterer
    org.hibernate.TransactionException: Could not register synchronization for container transaction

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.TransactionException

      Could not register synchronization for container transaction

      at org.hibernate.transaction.CMTTransaction.begin()
    2. Hibernate
      CMTTransaction.begin
      1. org.hibernate.transaction.CMTTransaction.begin(CMTTransaction.java:45)
      1 frame
    3. org.hibernate.ejb
      JoinableCMTTransaction.begin
      1. org.hibernate.ejb.transaction.JoinableCMTTransaction.begin(JoinableCMTTransaction.java:70)
      1 frame
    4. Hibernate
      SessionImpl.beginTransaction
      1. org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
      1 frame
    5. com.dolby.persist
      TriggerEventListener.onPostUpdate
      1. com.dolby.persist.listener.trigger.AuditTrigger.audit(AuditTrigger.java:67)
      2. com.dolby.persist.listener.trigger.AuditTrigger.fireAfterUpdateTrigger(AuditTrigger.java:293)
      3. com.dolby.persist.listener.trigger.TriggerEventListener.onPostUpdate(TriggerEventListener.java:522)
      3 frames
    6. Hibernate
      EntityUpdateAction.execute
      1. org.hibernate.action.EntityUpdateAction.postUpdate(EntityUpdateAction.java:180)
      2. org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:159)
      2 frames
    7. Hibernate
      ActionQueue.executeActions
      1. org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
      2. org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
      3. org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
      3 frames
    8. Hibernate
      CriteriaImpl.uniqueResult
      1. org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
      2. org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
      3. org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
      4. org.hibernate.impl.SessionImpl.list(SessionImpl.java:1562)
      5. org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
      6. org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
      6 frames
    9. com.dolby.persist
      GenericHibernateCrudDAO.merge
      1. com.dolby.persist.dao.hibernate.GenericHibernateFinderDAO.findById(GenericHibernateFinderDAO.java:250)
      2. com.dolby.persist.dao.hibernate.GenericHibernateCrudDAO.merge(GenericHibernateCrudDAO.java:112)
      2 frames
    10. com.dolby.pics
      InventoryBean.save
      1. com.dolby.pics.core.ejb.bean.impl.InventoryBean.save(InventoryBean.java:99)
      1 frame
    11. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    12. org.jboss.aop
      MethodInvocation.invokeNext
      1. org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      1 frame
    13. org.jboss.ejb3
      InvocationContextImpl.proceed
      1. org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      1 frame
    14. com.dolby.pics
      DefaultInterceptor.log
      1. com.dolby.pics.core.ejb.bean.impl.DefaultInterceptor.log(DefaultInterceptor.java:36)
      1 frame
    15. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:585)
      3 frames
    16. org.jboss.ejb3
      EJB3InterceptorsInterceptor.invoke
      1. org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      2. org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      2 frames
    17. org.jboss.aop
      MethodInvocation.invokeNext
      1. org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      1 frame
    18. org.jboss.ejb3
      TransactionScopedEntityManagerInterceptor.invoke
      1. org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      1 frame
    19. org.jboss.aop
      MethodInvocation.invokeNext
      1. org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      1 frame
    20. org.jboss.ejb3
      AllowedOperationsInterceptor.invoke
      1. org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
      1 frame
    21. org.jboss.aop
      MethodInvocation.invokeNext
      1. org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      1 frame
    22. org.jboss.aspects
      TxInterceptor$Required.invoke
      1. org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
      2. org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
      2 frames
    23. org.jboss.aop
      MethodInvocation.invokeNext
      1. org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      1 frame
    24. org.jboss.aspects
      TxPropagationInterceptor.invoke
      1. org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
      1 frame
    25. org.jboss.aop
      MethodInvocation.invokeNext
      1. org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      1 frame
    26. org.jboss.ejb3
      StatelessInstanceInterceptor.invoke
      1. org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
      1 frame
    27. org.jboss.aop
      MethodInvocation.invokeNext
      1. org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      1 frame
    28. org.jboss.aspects
      AuthenticationInterceptor.invoke
      1. org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      1 frame
    29. org.jboss.ejb3
      Ejb3AuthenticationInterceptor.invoke
      1. org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
      1 frame
    30. org.jboss.aop
      MethodInvocation.invokeNext
      1. org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      1 frame
    31. org.jboss.ejb3
      ENCPropagationInterceptor.invoke
      1. org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
      1 frame
    32. org.jboss.aop
      MethodInvocation.invokeNext
      1. org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      1 frame
    33. org.jboss.ejb3
      AsynchronousInterceptor.invoke
      1. org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      1 frame
    34. org.jboss.aop
      MethodInvocation.invokeNext
      1. org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      1 frame
    35. org.jboss.ejb3
      StatelessContainer.dynamicInvoke
      1. org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
      1 frame
    36. org.jboss.aop
      Dispatcher.invoke
      1. org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
      1 frame
    37. JBoss Application Server Aspects
      AOPRemotingInvocationHandler.invoke
      1. org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      1 frame
    38. org.jboss.remoting
      ServerThread.run
      1. org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
      2. org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
      3. org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
      4. org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
      4 frames