2 hayoouch hayoouch 于 2014.08.28 09:20 提问

java c3p0时不时的报异常,谁碰到过

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Socket input is already shutdown

STACKTRACE:

java.net.SocketException: Socket input is already shutdown
at java.net.Socket.shutdownInput(Socket.java:1361)
at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:1683)
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4388)
at com.mysql.jdbc.ConnectionImpl.cleanup(ConnectionImpl.java:1368)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2654)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2570)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1474)
at com.mysql.jdbc.DatabaseMetaData$9.forEach(DatabaseMetaData.java:4967)
at com.mysql.jdbc.IterateBlock.doForAll(IterateBlock.java:51)
at com.mysql.jdbc.DatabaseMetaData.getTables(DatabaseMetaData.java:4945)
at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnectio
nNoQuery(DefaultConnectionTester.java:185)
at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnectio
n(DefaultConnectionTester.java:62)
at com.mchange.v2.c3p0.AbstractConnectionTester.activeCheckConnection(Ab
stractConnectionTester.java:67)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionRe
sourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:368)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionRe
sourcePoolManager.refurbishIdleResource(C3P0PooledConnectionPool.java:310)
at com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTa
sk.run(BasicResourcePool.java:1999)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(Thre
adPoolAsynchronousRunner.java:547)

** END NESTED EXCEPTION **

以下是连接池配置
jdbc.initialPoolSize = 10
jdbc.minPoolSize = 5
jdbc.maxPoolSize = 30
jdbc.acquireIncrement = 5
jdbc.maxIdleTime = 30
jdbc.maxStatements = 0
jdbc.idleConnectionTestPeriod = 30
jdbc.acquireRetryAttempts = 30
jdbc.breakAfterAcquireFailure = true
jdbc.testConnectionOnCheckout = false
jdbc.checkoutTimeout = 30000

1个回答

u014141234
u014141234   2014.08.28 12:41

这种错误是因为你代码中提前关闭了会话造成的,与连接池的配置没有关系。从这方面出发,找找框架事务方面的配置是否有问题,或者代码中手动提交了事务。

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!