14 Replies Latest reply on Apr 11, 2014 10:10 AM by Amarnath RC

    Nullpointer at creation of EntityManager in Wildfly. Same setup works in Jboss711

    Amarnath RC Newbie

      Using JPA 2 with Hibernate 4.1.0 as provider in WildFly. Hibernate 410 jars defined inside the application classpath (EAR). This is Spring based web application and the entityManager is autowired by Spring container.

       

      The same setup works in Jboss 711 and below is the error & persistence.xml. Any help appreciated.

       

       

      Error:

       

      014-04-10 19:17:34 [ERROR] [stderr:71] java.lang.NullPointerException

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:76)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:118)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMTTransaction.java:149)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1602)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:210)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at org.hibernate.jpa.internal.EntityManagerImpl.<init>(EntityManagerImpl.java:91)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at org.hibernate.jpa.internal.EntityManagerFactoryImpl.internalCreateEntityManager(EntityManagerFactoryImpl.java:345)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at org.hibernate.jpa.internal.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:313)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at java.lang.reflect.Method.invoke(Method.java:606)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:376)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:517)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at com.sun.proxy.$Proxy76.createEntityManager(Unknown Source)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:234)

      2014-04-10 19:17:34 [ERROR] [stderr:71]  at com.sun.proxy.$Proxy77.createQuery(Unknown Source)

       

      ---------------------------------------------------------------------------------

       

      Persistence.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence version="1.0"
      xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

      <persistence-unit name="CPSPersistenceUnit" transaction-type="JTA">

      <provider>org.hibernate.ejb.HibernatePersistence</provider> <!-- tried with org.hibernate.jpa.HibernatePersistenceProvider as well but no luck -->

      <jta-data-source>java:jboss/jdbc/CPSDatabase</jta-data-source>

      <class..>

      <properties>
          <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
          <property name="hibernate.show_sql" value="true" />
          
          <property name="hibernate.transaction.manager_lookup_class"
           value="org.hibernate.transaction.JBossTransactionManagerLookup" />

          <property name="jta.UserTransaction" value="java:comp/UserTransaction" />
       

         </properties>

        </persistence-unit>
      </persistence>

       

      --------------------------------------------------------------------------------

       

      <datasource jta="true" jndi-name="java:jboss/jdbc/CPSDatabase" pool-name="CPSDatabase" enabled="true" use-ccm="false">

                          <connection-url>myurl</connection-url>

                          <driver-class>oracle.jdbc.OracleDriver</driver-class>

                          <driver>OracleJDBCDriver</driver>

                          <security>

                              <user-name>user</user-name>

                              <password>pass</password>

                          </security>

                          <validation>

                              <validate-on-match>false</validate-on-match>

                              <background-validation>false</background-validation>

                          </validation>

                          <statement>

                              <share-prepared-statements>false</share-prepared-statements>

                          </statement>

                      </datasource>