tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: DBCP abandoned trace - unable to understand the leak
Date Thu, 04 Nov 2010 15:40:08 GMT
Hash: SHA1


On 11/4/2010 8:34 AM, sasidhar prabhakar wrote:
> The class is fine but in log it is showing this one. Here everything closed
> fine.
> Then why it is showing like this
> DBCP object created 2010-11-04 11:07:59 by the following code was never
> closed:

I have found that these exceptions can occur even when there is no leak.

Specifically, if your SQL query takes a long time to run (that is, more
than the ababdonedTimeout), another request to the connection pool
complains about the connection and calls it abandoned.

Technically speaking, the connection hasn't been leaked, but the
connection pool can't really guess the reason why the connection hasn't
been returned.

Can you time your queries to see how long they take? Could you post your
<Resource> configuration for your DataSource?

Another note: I notice that you are using a DataSource object that
survives for the life of the DAO object, and is even created by the
object in its constructor. I usually recommend that your code obtain the
DataSource from the JNDI context each time it needs it to improve
flexibility. You could also use dependency injection if that it your
preferred mechanism for obtaining (or being provided with) a DataSource.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message