Unclosed connection trouble
controlcho Apr 8, 2009 12:12 PMI'm using JBoss 5.0.1 GA with SEAM 2.1.1
Here is my test setup:
I have a simple stateless bean that is a SEAM component at the same time. I have the following method:
public void testConn() { try { Connection connection = ds.getConnection(); } catch (SQLException e) { e.printStackTrace(); } }
I'm injecting the DataSource with a @Resource annotation but I've tried getting it from the entity manager too.
Here is what happens when I call the method:
[CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.jdk5.WrappedConnectionJDK5@61e76ee9 java.lang.Throwable: STACKTRACE at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:278) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:524) at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89) ........ ......... ............. INFO [TxConnectionManager] throwable from unregister connection java.lang.IllegalStateException: Trying to return an unknown connection2! org.jboss.resource.adapter.jdbc.jdk5.WrappedConnectionJDK5@61e76ee9 at org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConnection(CachedConnectionManager.java:330) at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnectionManager.java:720) at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:362) at org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:155)
I've researched the subject in the wiki and gone trough the forums and I think I have an understanding of what is happening. http://www.jboss.org/community/docs/DOC-9255
I don't want to turn CachedConnectionInterceptor off. This worked fine in 4.2.2/3
I tried upgrading the EJB3 implementation but got the same result.
The question is "How do I make JDBC calls and not get this error?"