Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jdbc connection error: not associated with a managed connection

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

like image 272
Aleksandar Mitrev Avatar asked Sep 12 '13 22:09

Aleksandar Mitrev


2 Answers

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.

like image 80
user3754761 Avatar answered Nov 02 '22 18:11

user3754761


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.

like image 40
Nicolas Zozol Avatar answered Nov 02 '22 17:11

Nicolas Zozol