com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager

 最近在跟着做慕课网上的SSM校园商铺项目,刚把配置文件弄完,测试dao层就遇到了这样的错误。

这是控制台DEBUG信息:

 DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@78fa769e] was not registered for synchronization because synchronization is not active
二月 18, 2019 10:31:09 下午 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 2, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 10000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge0ysa1a5z6r1pwvwb4|6d763516, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge0ysa1a5z6r1pwvwb4|6d763516, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/o2o?useUnicode=true&characterEncoding=utf8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
22:31:10.339 [main] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@14f232c4] will not be managed by Spring

com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager_第1张图片

这是Junit单元测试变红的错误信息:

java.lang.AbstractMethodError: Method com/mchange/v2/c3p0/impl/NewProxyPreparedStatement.isClosed()Z is abstract
    at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.isClosed(NewProxyPreparedStatement.java) ......

 

网上给的解决方案是将c3p0依赖的版本调高:

c3p0-0.9.2.1换成c3p0-0.9.5.2

 

直接在pom里面改版本好发现出现错误,因为根本“没有”这个版本的c3p0!

然后到maven中央仓库一搜索c3p0,发现有两种c3p0:

com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager_第2张图片

 教程里引用的是下面c3p0中的921版本,它更新到2007年就没更新了:

	
	    c3p0
	    c3p0
	    0.9.1.2
	

com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager_第3张图片


   而95+版本其实是上面c3p0的,最新的已经是953了,它们的groupid不同。

com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager_第4张图片

所以修改起来也很容易,把之前的c3p0注释(去)掉,并添加新的c3p0:


    com.mchange
    c3p0
    0.9.5.3

最后再maven update一下就好了。

你可能感兴趣的:(JavaWebError)