6
votes

My application is trowing the following exception:

java.sql.SQLException: Connection is not associated with a managed connection.org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6@4fe91321

This is happening in production I'm not able to get this problem in development and for that I'm not able to solve it.
The root of the exception is code line dbConn.prepareStatement(sql);

From what I was able to find in the web, the cause for this can be:

  1. Over jdbc connection, a jboss connection is wrapped but the wrapper is empty. The original jdbc connection inside is no longer there.

  2. JDBC Connection is already closed and trying to work with close connection is the reason why I'm getting this exception.

  3. The transaction manger detects transaction that is taking to long then the transaction timeout.

So if someone can point me what is the problem because I'm not able to get this problem in mine development environment.
Also what logs can I add that will help me detect the problem in production - I'm using Java, JBoss, Postgre.

I'have enable connection close monitoringa, and also to add is that the issue is not consistent

2
Looks like you're not closing your resources after using them i.e. resultSet.close(); preparedStatement.close(); connection.close();. If this is well handled in your application, then there must be a third agent that is interfering with this process.Luiggi Mendoza
As user3754761 said, change your jdbc driver of setup.Aung Myat Hein

2 Answers

2
votes

I just resolved the issue.

It's my jndi driver not compatible with the latest java frameworks.

I'm using Oracle db and ojdbc6, and i download a latest ojdbc6 from maven repository and replace the old same name jar file. It works like bird now.

1
votes

If you are using an EJB, it's possible that your Stateless Session Bean Pool is not big enough. The connection can't find an associated thread.

Maybe you have an extended Transaction for a not Stateful Session Bean, wich is maybe not a good idea.