尝试创建查询时,我一直收到此错误消息。看过类似的线程,但我认为我的设置看起来是正确的。如果我改为RESOURCE_LOCAL(我不想要),它就可以了。有什么建议吗?
环境 - Weblogic 12.1.3,Hibernate 4.3.11。
EJB Exception: : java.lang.NullPointerException
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:76)
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:118)
at org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMTTransaction.java:149)
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1602)
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:210)
at org.hibernate.jpa.internal.EntityManagerImpl.<init>(EntityManagerImpl.java:91)
at org.hibernate.jpa.internal.EntityManagerFactoryImpl.internalCreateEntityManager(EntityManagerFactoryImpl.java:345)
at org.hibernate.jpa.internal.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:313)
at weblogic.persistence.PersistenceContextWrapper.<init>(PersistenceContextWrapper.java:23)
at weblogic.persistence.TransactionalEntityManagerProxyImpl.newPersistenceContext(TransactionalEntityManagerProxyImpl.java:123)
at weblogic.persistence.TransactionalEntityManagerProxyImpl.getPersistenceContext(TransactionalEntityManagerProxyImpl.java:103)
at weblogic.persistence.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:105)
at weblogic.persistence.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:138)
at weblogic.persistence.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:91)
的persistence.xml:
<persistence-unit name="HIF-BannerPU" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>jdbc/HIF-Banner</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<class>com.hsntech.hif.entity.Uctvmstr</class>
<class>com.hsntech.hif.entity.Uctvvals</class>
<properties>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
</properties>
</persistence-unit>
测试类:
@Stateless
public class Testeaoimpl implements Testeao {
@PersistenceContext(unitName = "HIF-BannerPU")
private EntityManager em;
// *** exception thrown here
Query qry = em.createQuery("select m from Uctvmstr m");