"Connection is not associated with a managed connection" when Connection is reused in JBoss EAP

Solution Verified - Updated -

Issue

  • Application code is caching Connection and Statement / PreparedStatement references in local fields/instance variables.
  • When the references are re-used some time after their original initialization, exceptions like the below are encountered:

    java.sql.SQLException: Connection is not associated with a managed connection.org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8@174b8c5
    
    java.sql.SQLException: Connection is not associated with a managed connection.org.jboss.jca.adapters.jdbc.jdk7.WrappedConnectionJDK7@174b8c5
    
    java.sql.SQLException: Connection is not associated with a managed connection.org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@174b8c5
    
    java.sql.SQLException: Connection is not associated with a managed connection.org.jboss.resource.adapter.jdbc.WrappedConnection@19ce161
    
  • The connection package/class varies with EAP version.

Environment

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

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