"Connection is not associated with a managed connection" when Connection is reused in JBoss EAP
Issue
- Application code is caching
Connection
andStatement
/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.