I'm using a dynamic Java Web Application (Tomcat 8.0.15, Java EE 7 Web) with a SQL Server 2008 and after getting the warning/exception
WARNING [Tomcat JDBC Pool Cleaner[510210701:1481713957404]] org.apache.tomcat.jdbc.pool.ConnectionPool.suspect Connection has been marked suspect, possibly abandoned PooledConnection[net.sourceforge.jtds.jdbc.JtdsConnection@510fc080][67975 ms.]:java.lang.Exception
quite too often I wonder somewhere in the depths of my source code I forgot to disconnect a JDBC or Hibernate Connection to the database. I'd like to list them somehow.
A regular
static
{
try {
Context context = new InitialContext ();
dataSource = (DataSource) context.lookup("java:comp/env/jdbc/sqlserv");
} catch (NamingException ex) {
Logger.getLogger(Basisverbindung.class.getName()).log(Level.SEVERE, null, ex);
}
}
does that job and in my hibernate.cfg.xml it's the same:
<property name="hibernate.connection.datasource">java:comp/env/jdbc/sqlserv</property>
I looked through Stackoverflow and found only a few entries which I consulted already (and even upvoted):
- Tomcat 7 connection pooling error
- WebApp (Tomcat-jdbc) Pooled DB connection throwing abandon exception
- https://dba.stackexchange.com/questions/114759/tomcat7-jdbc-connection-pool-connection-has-been-abandoned
But the issue persists or comes up again after a while so I would like to find a way how to track down where I forgot to close the connection. On my Tomcat there's also a PSI Probe running telling me there are coming up some errors in the requests and sometimes maxing out the Response time. I see a nice list of requests there but don't know which ones are abandoned.
The ActivityMonitor in the SQL-Server Management Studio is not of too much help either it lists quite a few processes of which I know they are closed (or well, should be).
What's the best way to analyze that kind of problem?