NullPointerException starting JTA transaction from Spring code in JBoss EAP

Solution Verified - Updated -

Issue

  • NullPointerException when Spring attempts to start a transaction
java.lang.NullPointerException
    at org.hibernate.engine.transaction.internal.jta.JtaTransaction.getJoinStatus(JtaTransaction.java:274)
    at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.attemptToRegisterJtaSync(TransactionCoordinatorImpl.java:222)
    ...
    at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:174)
    at org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction(JpaTransactionManager.java:400)
    at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:321)
    ...
  • Hibernate configuration was created as below
...
    <persistence-unit name="MyPersistenceUnit" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:jboss/datasources/MyDS</jta-data-source>
        ...
        <properties>
            ...
            <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossStandaloneJtaPlatform" />
            <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
        </properties>
    </persistence-unit>
...

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6
  • Hibernate 4
  • Spring

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content