Skip to main content

Glassfish4 + Hibernate4.3.5 => NullPointer when injecting

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
edilmar
Offline
Joined: 2003-11-13

Hi,

I have an webapp running fine in this env:
Glassfish 3.1.1 + JSF 2.0 + Weld 1.1 + CODI 1.0.6 + Richfaces 4.3.5 +
Firebird 2.5.2 + Jaybird 2.2.4 + JPA 2.0 + Hibernate 4.2.7

Now I'm trying to test a new env:
Glassfish 4.0 + JSF 2.0 + Weld 2.0 + CODI 1.0.6 + Richfaces 4.3.5 +
Firebird 2.5.2 + Jaybird 2.2.4 + JPA 2.1 + Hibernate 4.3.5

I didn't change any config files (web.xml, ejb-jar.xml, beans.xml, persistence.xml),
no problems when deploying.

However, when I try to run the webapp in the new env, Glassfish arises
NullPointerException in the line to use a EntityManager previouly injected by Weld.

Here is one example of exception:

[2014-04-02T15:09:59.021-0400] [glassfish 4.0] [SEVERE] [] [] [tid: _ThreadID=19 _ThreadName=Thread-4] [timeMillis: 1396465799021] [levelValue: 1000] [[
  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:338)
        at com.sun.enterprise.container.common.impl.EntityManagerWrapper.getNonTxEMFromCurrentInvocation(EntityManagerWrapper.java:268)
        at com.sun.enterprise.container.common.impl.EntityManagerWrapper._getDelegate(EntityManagerWrapper.java:213)
        at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:455)
        at util.Chave.<init>(Chave.java:20)
        at util.GeralSis.getEmpresa(GeralSis.java:285)
        at clientws.InstallClientWS.getRun(InstallClientWS.java:31)
        at clientws.InstallClientWS$Proxy$_$$_WeldClientProxy.getRun(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)