首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 互联网 >

tomcat资源泄露

2012-12-20 
tomcat资源泄漏当启动tomcat时有时候会出现这样的问题:A C3P0Registry mbean is already registered. This

tomcat资源泄漏

当启动tomcat时有时候会出现这样的问题:

A C3P0Registry mbean is already registered. This probably means that an application using c3p0 was undeployed, but not all PooledDataSources were closed prior to undeployment. This may lead to resource leaks over time. Please take care to close all PooledDataSources.


当一个tomcat下启动两个或两个以上使用了C3P0的系统时,就会出现以上警告信息。 
有源代码可以看出问题(attemptManageC3P0Registry方法),也就是c3p0的托管bean已经注册了,再次注册的时候就会警告。 

所以可以改bean的名字。


另一个解决方法:

To avoid the C3P0Registry from being loaded and registered multiple times (when deploying multiple webapps, when reloading a given webapp), my recommendation would be to move the C3P0 JAR (and the JDBC driver) from the Webapp classloader (WebappX/WEB-INF/lib) to the Common classloader ($TOMCAT_HOME/lib).


还可以这样解决:

在c3p0.properties 文件中添加一行: 

com.mchange.v2.c3p0.management.ManagementCoordinator=com.mchange.v2.c3p0.management.NullManagementCoordinator

if you are experiencing memory leak problems, however, this won't resolve the situation. In my post I supposed that the crashes I had were a direct effetct of the wrong management of C3P0, but it turned not to be the real issue. 

原文:http://blog.csdn.net/hongchangfirst/article/details/7931823

作者:hongchangfirst



热点排行