具有Hibernate的WebSphere可嵌入EJB容器抛出java.lang.ClassNotFoundException:com.ibm.websphere.jtaextensions.SynchronizationCallback [英] WebSphere embeddable EJB container with Hibernate throws java.lang.ClassNotFoundException: com.ibm.websphere.jtaextensions.SynchronizationCallback

查看:109
本文介绍了具有Hibernate的WebSphere可嵌入EJB容器抛出java.lang.ClassNotFoundException:com.ibm.websphere.jtaextensions.SynchronizationCallback的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WebSphere 8的可嵌入EJB容器使用JUnit4为我的EJB编写一些单元测试.我在MyEclipse中有一个简单的Java项目,其中引用了EJB项目. EJB项目使用Hibernate 3.5进行持久化,并且hibernate.cfg.xml中的数据源JNDI是jdbc/connectionname,它在可嵌入容器的属性中定义.

I am using the embeddable EJB container of WebSphere 8 to write some unit tests for my EJBs with JUnit4. I have a simple java project in MyEclipse where I reference the EJB project. The EJB project uses Hibernate 3.5 for persistence and the datasource JNDI in hibernate.cfg.xml is jdbc/connectionname which is defined in the properties of the embeddable container.

可嵌入容器成功启动,可以成功找到EJB,也可以成功找到数据源.但是,在EJB方法的任何第一个方法调用上,都会引发以下跟随异常:

The embeddable container starts successfully, the EJBs can be found successfully and the datasource is also found successfully. However, on any first method call of an EJB method the followin exception is thown:

org.hibernate.HibernateException: java.lang.ClassNotFoundException: com.ibm.websphere.jtaextensions.SynchronizationCallback
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.<init>(WebSphereExtendedJTATransactionLookup.java:108)
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.<init>(WebSphereExtendedJTATransactionLookup.java:88)
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup.getTransactionManager(WebSphereExtendedJTATransactionLookup.java:70)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:367)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)

任何建议将不胜感激.

推荐答案

WebSphere Application Server中的可嵌入EJB容器不支持ExtendedJTATransaction,但它确实支持java:comp/TransactionSynchronizationRegistry.我对Hibernate并不熟悉,但是似乎应该对其进行更新以在可用时使用TransactionSynchronizationRegistry.

The embeddable EJB container in WebSphere Application Server does not support ExtendedJTATransaction, but it does support java:comp/TransactionSynchronizationRegistry. I am not familiar with Hibernate, but it would seem that it should be updated to use TransactionSynchronizationRegistry when available.

这篇关于具有Hibernate的WebSphere可嵌入EJB容器抛出java.lang.ClassNotFoundException:com.ibm.websphere.jtaextensions.SynchronizationCallback的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆