We have a web application that uses Hibernate. Here is what is in the
WEB-INF/lib directory:
(I am not the developer).
hibernate3.jar
hibernate-c3p0-4.1.1.Final.jar
hibernate-commons-annotations-4.0.2.Final.jar
hibernate-core-4.2.2.Final.jar
hibernate-entitymanager-4.2.2.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate-tools-4.0.0-CR1.jar
We have a clustered Tomcat7 (apache + mod_jk) environment and are attempting to use the FarmWarDeployer. The FarmWarDeployer is working - it deploys the war across the farm.
The ProblemThe problem we are having is that the connections to the MySQL servers are not being closed when the FarmWarDeployer re-deploys the WAR. The connections to the MySQL server remain and when the application restarts it doesn't use the same MySQL connections and it doesn't create new connections. The application faults saying it cannot connect to the database server (see log below). We have to restart Tomcat in order to get the application to work properly.
catalina.outCode:
=====================Intialize session====================
....
Sep 24, 2013 1:47:50 PM org.apache.catalina.ha.deploy.FarmWarDeployer fileModified
INFO: Installing webapp [/WebTools] from [/d01/tomcat/wt/test/eci/webapps/WebTools.war]
Sep 24, 2013 1:47:50 PM org.apache.catalina.ha.deploy.FarmWarDeployer remove
INFO: Cluster wide remove of web app [/WebTools]
Sep 24, 2013 1:47:50 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/WebTools]
Sep 24, 2013 1:47:51 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/WebTools] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1br4n4i8xmhgjgp1p43mhh|5e648d63]-AdminTaskTimer] but has failed to stop it. This is very likely to create a memory leak.
Sep 24, 2013 1:47:51 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/WebTools] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1br4n4i8xmhgjgp1p43mhh|5e648d63]-HelperThread-#0] but has failed to stop it. This is very likely to create a memory leak.
Sep 24, 2013 1:47:51 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/WebTools] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1br4n4i8xmhgjgp1p43mhh|5e648d63]-HelperThread-#1] but has failed to stop it. This is very likely to create a memory leak.
Sep 24, 2013 1:47:51 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/WebTools] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1br4n4i8xmhgjgp1p43mhh|5e648d63]-HelperThread-#2] but has failed to stop it. This is very likely to create a memory leak.
Sep 24, 2013 1:47:51 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/WebTools] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1br4n4i8xmhgjgp1p43mhh|b9b91c6]-AdminTaskTimer] but has failed to stop it. This is very likely to create a memory leak.
Sep 24, 2013 1:47:51 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/WebTools] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1br4n4i8xmhgjgp1p43mhh|b9b91c6]-HelperThread-#0] but has failed to stop it. This is very likely to create a memory leak.
Sep 24, 2013 1:47:51 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/WebTools] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1br4n4i8xmhgjgp1p43mhh|b9b91c6]-HelperThread-#1] but has failed to stop it. This is very likely to create a memory leak.
Sep 24, 2013 1:47:51 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /d01/tomcat/wt/test/eci/webapps/WebTools.war
Sep 24, 2013 1:47:51 PM org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor report
INFO: ThroughputInterceptor Report[
Tx Msg:20025 messages
Sent:204.81 MB (total)
Sent:204.82 MB (application)
Time:4.94 seconds
Tx Speed:41.44 MB/sec (total)
TxSpeed:41.44 MB/sec (application)
Error Msg:0
Rx Msg:2 messages
Rx Speed:0.00 MB/sec (since 1st msg)
Received:0.00 MB]
Sep 24, 2013 1:47:52 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
=====================Intialize session====================
org.hibernate.exception.GenericJDBCException: Could not open connection
....
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
....
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
....
INSDIE CATCH ERROR Throwable1
org.hibernate.exception.GenericJDBCException: Could not open connection
INSDIE CATCH ERROR Throwable ENDCXV
....
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
....
I'll answer some typical questions:
1) NO, the MySQL server is not out of connections.
2) NO, the user being uses is not out of connections (user is unlimited).
3) Do the stale connections drop? Yes, after the inactivity of 28800 seconds (8 hours).
4) Does the application ever re-establish connection? No. TOMCAT must be restarted.
Anyone have any advice or settings that I need to check or set?
Is there something I should pass on to the developers?