警告处理 A C3P0Registry mbean is already registered. This probably means that an application using c3p.

来源:互联网 发布:淘宝漏洞1元6s的网址 编辑:程序博客网 时间:2024/06/05 03:13

遇到完整的警告信息如下:

[java] view plaincopyprint?
  1. WARN 2010-11-06 19:04:37,270 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.  

遇到此警告通常是在同一个web容器下部署了多个使用c3p0的项目(例如:tomcat下面部署了多个使用c3p0的webapp)。


解决的方法可以是:


1.如果你不使用JMX,那么你可以在src下建立一个c3p0.properties,内容如下:

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


2.建议将项目内(例如:WebappX/WEB-INF/lib)的c3p0的相关依赖包(C3P0的jar和JDBC driver的jar)删除,将这些包转移到容器的共享lib目录下(例如:$TOMCAT_HOME/lib


问题解决。


0 0
原创粉丝点击