开发者

Transaction synchornization registration problem

For our web application built with Seam with have a bunch of server test cases. These run on multiple systems (Mac OS X and Linux); normally, you can clone the repository and run the test cases without any problem.

However, the test cases do not run on the laptop of one person in our team. He uses Fedora Core on a Lenovo Laptop. We encounter the following exception when the application is deployed to the embedded JBoss that Seam uses for Unit/Integration testing:

javax.persistence.PersistenceException:
org.hibernate.TransactionException: Could not register synchronization
   at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
   at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:547)
   at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:82)
   at org.hibernate.ejb.EntityManagerImpl.<init>(EntityManagerImpl.java:61)
   at org.hi开发者_JS百科bernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:39)
   at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:34)
   at org.jboss.ejb3.entity.InjectedEntityManagerFactory.createEntityManager(InjectedEntityManagerFactory.java:78)
   at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:79)
   at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:108)
   at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
   at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
   at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
   at org.jboss.seam.Component.unwrap(Component.java:2301)
   at org.jboss.seam.Component.getInstance(Component.java:2044)
   at org.jboss.seam.Component.getInstance(Component.java:1986)
   at org.jboss.seam.Component.getInstance(Component.java:1980)
   at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2375)
   at org.jboss.seam.Component.getValueToInject(Component.java:2327)
   at org.jboss.seam.Component.injectAttributes(Component.java:1739)
   at org.jboss.seam.Component.inject(Component.java:1557)
   at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97)
   at org.jboss.seam.util.Work.workInTransaction(Work.java:61)
   at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
   at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
   at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
   at com.ambitz.everest.bootstrap.EverestBootstrap_$$_javassist_seam_9.initializeEverest(EverestBootstrap_$$_javassist_seam_9.java)
   at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
   at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
   at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
   at org.jboss.seam.core.Events.raiseEvent(Events.java:85)
   at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:145)
   at org.jboss.seam.init.Initialization.init(Initialization.java:747)
   at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:919)
   at com.ambitz.everest.test.JUnitSeamTest.startContainer(JUnitSeamTest.java:65)
   at com.ambitz.everest.test.EverestServerTestSuite.setUpBeforeClass(EverestServerTestSuite.java:47)
Caused by: org.hibernate.TransactionException: Could not register synchronization
   at org.hibernate.transaction.CMTTransaction.registerSynchronization(CMTTransaction.java:213)
   at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:470)
Caused by: java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.syncsnotallowed] [com.arjuna.ats.internal.jta.transaction.arjunacore.syncsnotallowed] Synchronizations are not allowed!
   at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.registerSynchronizationImple(TransactionImple.java:473)
   at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.registerSynchronization(TransactionImple.java:441)
   at org.hibernate.transaction.CMTTransaction.registerSynchronization(CMTTransaction.java:210)

The test environment uses HSQLDB 2.1.0.

As I already said, the test cases run smoothly on other Linux machines (also with Fedora Core). Does anybody know, what might influence the CMTTransaction so that on this particular machine the transaction synchronization registration is not allowed?


In the meantime we found the problem and the solution: The problem was that arjuna was not able to resolve the host name of the machine and therefore was not able to create UIDs for the transactions. Interestingly, this information was only logged with WARN severity but had influence on the transaction synchronization.

The solution: we added the host name of the machine into /etc/hosts for 127.0.0.1.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜