My tomcat 5 server running on centos frequently (several times / day) produces the following error:
Apr 7, 2011 11:02:30 PM org.apache.catalina.loader.WebappClas
Newer versions of Tomcat require that you put JDBC driver JARs in the Tomcat /lib directory, not your WEB-INF. And there should only be one version in that directory - the version you want to use - and no others.
Since you're using Tomcat 5, I'd recommend putting the JAR in your server/lib directory.
I don't know if this is the root cause of your problem, but it's worth a try.
Use only one version of jar file in WEB-INF/lib
directory. Better use the latest version of mysql-connector-java 5.1.26
.
You could check the order of directories in the classpath. I once had two versions of a jar file: one in the working directory and another in the Java Extensions directory. The order of the classpath was: check eclipse extensions directory first, then working directory second. Once it found a version of the jar in the extensions directory, it didn't keep looking for the one I was specifying in the working directory. Order matters in the classpath.
I think you have to use connection pooling mechanism for idle connections. or else check this link for connection pooling 'http://www.mkyong.com/hibernate/how-to-configure-the-c3p0-connection-pool-in-hibernate/'
Apart from using only one version of jar (which the other users have suggested), please check the following as well:
close()
call. IllegalStateException
as this connection object is not associated with any database connections. The error is not that the class can't be found. It's not being allowed to load because the web application has been stopped. I suspect this might be happening after the web application is restarted, where it's down for a short period of time. Then some finalize()
method in the code is probably trying to do some cleanup too late. Whether or not that's in your code or the MySQL driver I can't say. You definitely should only have one version of a jar in a directory at a time. You might want to upgrade it to the latest (5.1.15 right now) in case something has been fixed that might be affecting you.