问题描述:
六月 23, 2017 9:16:59 下午 com.mchange.v2.log.MLog <clinit>
信息: MLog clients using java 1.4+ standard logging.
六月 23, 2017 9:16:59 下午 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.2-pre1 [built 27-May-2010 01:00:49 -0400; debug? true; trace: 10]
六月 23, 2017 9:16:59 下午 com.mchange.v2.c3p0.management.ActiveManagementCoordinator attemptManageC3P0Registry
警告: 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.
六月 23, 2017 9:16:59 下午 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 2sphqx9o1n4kyee1y0dhb6|261b7059, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 2sphqx9o1n4kyee1y0dhb6|261b7059, idleConnectionTestPeriod -> 0, initialPoolSize -> 5, jdbcUrl -> jdbc:mysql://localhost:3306/bookstore, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 8, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 2, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, statementDestroyerNumActiveThreads -> -1, statementDestroyerNumConnectionsInUseAllUsers -> -1, statementDestroyerNumConnectionsInUseDefaultUser -> -1, statementDestroyerNumConnectionsWithDeferredDestroyStatementsAllUsers -> -1, statementDestroyerNumConnectionsWithDeferredDestroyStatementsDefaultUser -> -1, statementDestroyerNumDeferredDestroyStatementsAllUsers -> -1, statementDestroyerNumDeferredDestroyStatementsDefaultUser -> -1, statementDestroyerNumIdleThreads -> -1, statementDestroyerNumTasksPending -> -1, statementDestroyerNumThreads -> -1, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
出现此问题的原因:
通常是由于在同一个web容器下部署了多个使用c3p0的项目(如:在tomcat\ webapps下面部署了多个使用c3p0的项目)
我遇到这个问题的原因是在tomcat里部署了两个使用c3p0的项目
解决方法:
1.若你不使用JMX,那你可以在src下建一个c3p0.properties文件,内容:
com.mchange.v2.c3p0.management.ManagementCoordinator=com.mchange.v2.c3p0.management.NullManagementCoordinator
2.建议将项目内的c3p0的相关依赖包 (C3P0的jar和JDBC driver的jar) 删除,将这些包转移到容器的共享lib目录下(tomcat\lib)。
原文:https://blog.csdn.net/kzadmxz/article/details/73656352