'java.lang.NullPointerException' in DatasourceConnectionProviderImpl.closeConnection when using Hibernate in JBoss EAP

Solution Verified - Updated -

Issue

Encountering a NullPointerException during connection reference cleanup following EntityManager merge operations or transaction completion/finalization

... java.lang.NullPointerException
        at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.closeConnection(DatasourceConnectionProviderImpl.java:127)
        at org.hibernate.internal.NonContextualJdbcConnectionAccess.releaseConnection(NonContextualJdbcConnectionAccess.java:46)
        at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.releaseConnection(LogicalConnectionManagedImpl.java:196)
        ...

Note that a stack trace similar to the above (which was taken from a Hibernate 5/EAP 7 application) may be seen with Hibernate 4/EAP 6 though the exact class names, line numbes, etc. may differ slightly.

Environment

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

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