求助:tomcat下项目冲突造成memory leak

先说说情况.

两个项目 A和B,单独放在同一环境不同tomcat启动都没问题.放在一个tomcat的webapps下面就会出错,只能正常启动其中的一个,另一个就起不来.

其中A项目出错的日志:

2013-6-29 0:27:58 org.apache.catalina.core.StandardContext startInternal
严重: Error listenerStart
2013-6-29 0:27:58 org.apache.catalina.core.StandardContext startInternal
严重: Context [/A] startup failed due to previous errors
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/A] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [Timer-1] but has failed to stop it. This is very likely to create a memory leak.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [schedulerFactoryBean_Worker-1] but has failed to stop it. This is very likely to create a memory leak.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [schedulerFactoryBean_Worker-2] but has failed to stop it. This is very likely to create a memory leak.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [schedulerFactoryBean_Worker-3] but has failed to stop it. This is very likely to create a memory leak.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [schedulerFactoryBean_Worker-4] but has failed to stop it. This is very likely to create a memory leak.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [schedulerFactoryBean_Worker-5] but has failed to stop it. This is very likely to create a memory leak.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [schedulerFactoryBean_Worker-6] but has failed to stop it. This is very likely to create a memory leak.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [schedulerFactoryBean_Worker-7] but has failed to stop it. This is very likely to create a memory leak.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [schedulerFactoryBean_Worker-8] but has failed to stop it. This is very likely to create a memory leak.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [schedulerFactoryBean_Worker-9] but has failed to stop it. This is very likely to create a memory leak.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [schedulerFactoryBean_Worker-10] but has failed to stop it. This is very likely to create a memory leak.
2013-6-29 0:27:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/A] appears to have started a thread named [Timer-2] but has failed to stop it. This is very likely to create a memory leak.

==========================================================================

刚开始以为是

严重: The web application [/A] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

这个原因造成的问题,但后来[com.mysql.jdbc.Driver] 这个问题解决了,后面的日志依然存在.

从日志来看,好像是quartz出了问题.我看了一下,A和B项目都有用到quartz,我试过统一quartz的jar包或版本,放在tomcat的lib下面,问题仍然存在.

tomcat版本是7,内存分配足够.

求助,如有遇到相同问题而且搞定的经验,希望告知,感谢大家!

阅读 77.3k
3 个回答

y遇到了跟你一样的问题,请问是如何解决的

If a webapp contains a JDBC driver (e.g. in WEB-INF/lib), the driver will be registered with the DriverManager when it is first used. When the application is stopped, the driver should be deregistered with DriverManager to avoid a classloader leak. Since applications usually forget this, tomcat helps by deregistering the driver.

这个报错不会有什么影响的

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题