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

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

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


问题解决。


参考:http://stackoverflow.com/questions/4113759/multiple-applications-having-c3p0-configuration-gives-warning

你可能感兴趣的:(警告处理 A C3P0Registry mbean is already registered. This probably means that an application using c3p.)