tomcat 6.0.24 Exception: Could not load com.mysql.jdbc.SQLError

前端 未结 8 733
甜味超标
甜味超标 2021-02-04 18:20

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         


        
相关标签:
8条回答
  • 2021-02-04 19:18

    Where is your JDBC connection pool configured? Is it in Tomcat's JNDI (conf/server.xml) or directly in your application? Is one of your web apps undeployed/redeployed when that message appears?

    From the stacktrace and source code of MysqlIO.java and WebappClassLoader.java I would guess that:

    • one of the webapps is undeployed - based on the code in WebappClassLoader:

      // Log access to stopped classloader

      if (!started) { try { throw new IllegalStateException(); } catch (IllegalStateException e) { log.info(sm.getString("webappClassLoader.stopped", name), e); } }

    • your JDBC connections are not clean up correctly during the web app shutdown (your ServletContextListener.contextDestroyed should do that or e.g. Spring's bean destroy-method parameter)

    • some of the classes that are used by MySQL driver code got unloaded by GC
    • those connections are GC eligible when your application shutdowns but GC finds that MySQL connection finalize method is overriden so it executes it
    • when that finalize method is executed it requires a class that needs to be loaded. The Tomcat's class loader of your stopped web app detects it and reports that there should be no other classes loaded by a stopped web app.

    My solution to your problem would be to check how your JDBC connection pool is cleaned up during web app shutdown and make sure the pool is also explicitly shutdown.

    0 讨论(0)
  • 2021-02-04 19:20

    You are most probably usign connection pooling in you application which is checking for database connectivity.

    0 讨论(0)
提交回复
热议问题