Question

Thank you for taking time to look at my question.

I developing a Java WAR file intended for distribution to only one server at a time. So far, I have tested on 3 different servers with success, one Debian, one Ubuntu and the other, the Windows machine I'm developing on.

On the final deployment server, for some reason the app deploys fine, and upon each startup, runs well for about 3 minutes. Database connectivity works, everything runs fine. After 3 minutes however, I start seeing NoClassDefFoundError's consistently every time the app tries to access the DB.

I'm the following libraries with all of them packaged in the WAR file:

Mysql/j Connecter, latest version ActiveObjects, 0.8.2 Jasorb 1.3 Jython 2.5.1 (for some scripting) Tomcat 6.0.20 mod_python Apache

The error:

Exception in thread "Timer-4" java.lang.NoClassDefFoundError: com/mysql/jdbc/SQLError at com.mysql.jdbc.Util.handleNewInstance(Util.java:430) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:284) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at net.java.ao.DatabaseProvider.getConnectionImpl(DatabaseProvider.java:771) at net.java.ao.DatabaseProvider.getConnection(DatabaseProvider.java:734) at net.java.ao.EntityManager.find(EntityManager.java:666) at net.java.ao.EntityManager.find(EntityManager.java:607) at net.java.ao.EntityManager.find(EntityManager.java:579) at com.sq.sa.SAPushAlertsTask.run(SAPushAlertsTask.java:32) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.SQLError at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:138 7) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:123 3) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 13 more

Was it helpful?

Solution

Either your MySQL/J connector is somehow broken OR (more likely) you have another somewhere jar in your classpath that has only some of the classes from MySQL's JDBC driver. Either way, "com/mysql/jdbc/SQLError" class can't be found.

Your application runs fine the first few minutes, then when some error occurs the above class can't be loaded which throws the exception as posted. Check your entire classpath (CLASSPATH env. variable + tomcat's lib + webapp's lib) and see whether a) you actually do have SQLError in it and b) MySQL JDBC driver does not occur more than once.

Once the above is fixed, you'll get an actual error that's causing this and should be able to take it from there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top