A C3P0Registry mbean is already registered
在同一个tomcat下部署多个项目的时候,出现了如下警告:
2012-04-23 13:41:02,120 WARN (com.mchange.v2.c3p0.management.ActiveManagementCoordinator:56) - 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.
意思是C3P0Registry mbean已经被注册过啦!的确是已经在其他项目中已经对其进行了注册。
解决方案:将所有项目的将c3po和数据库驱动放到tomcat的lib下。
如果是单独一个使用c3p0的项目放在tomcat下,打出的日志是:2012-04-23 13:48:47,289 INFO (com.mchange.v2.c3p0.C3P0Registry:204) - Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
英文:
We had this problem when we were trying to deploy multiple applications within same tomcat. So it was a case of multiple class loaders within same VM.
How did we solve this ?
We moved the jar files from WEB-INF of each folder to the tomcat/lib directly.
Files moved
c3p0-0.9.1.jar
mysql-connector-java-5.1.7-bin
This solved the problem.
We were also seeing some out of memory problems which are not happening right now.
Refer to C3P pool documentation
http://www.mchange.com/projects/c3p0/index.html
http://www.mchange.com/projects/c3p0/index.html
推荐阅读
-
A C3P0Registry mbean is already registered
-
【Kafka】A broker is already registered on the path /brokers/ids/0. This probably indicates that you
-
The bean 'dataSource',could not be registered.A bean with that name has already been defined解决办法
-
Kafka错误:java.lang.RuntimeException: A broker is already registered on the path /brokers/ids/0. This