2012-11-30 110 views
2

我使用Hibernate 4与C3P0作为其连接提供程序。我目前没有使用 Spring框架。即时通讯使用的休眠4 + C3P0连接池返回错误

开发环境

Windows 7 
Eclipse Juno 
JRE-7 
JDK -7 

罐子......

hibernate-core-4.1.7.Final.jar 
c3p0-0.9.2-pre6.jar 
jtds-1.3.0.jar 

但在相同的库路径也有

hibernate-c3p0-4.1.1.Final.jar 
spring-orm-3.2.0.RC1.jar 

是否有机会与其他瓶子(hibernate-c3p0-4.1.1.Final.jar和spring-orm-3.2.0.RC1.jar)可能会对这个错误产生一些影响(见下文)?

是的,整个春天的框架罐子在路径上,但我只是想 习惯先休眠。我真的不知道如何使用Spring。现在让我们把这件事留在这里。

我可以创建连接并成功地查询数据库。 但我得到这个错误

Some resources failed to close properly while closing [email protected]

WARNING: Failed to destroy resource: [email protected] 

我得到的错误是相当重复的。 他们都是这样的

11월 30, 2012 4:39:59 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] Exceptions occurred while trying to close a PooledConnection's resources normally. 
11월 30, 2012 4:39:59 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] NewPooledConnection close Exception. 
java.sql.SQLException: I/O Error: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2388) 
    at net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:736) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.reset(JtdsStatement.java:722) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.close(JtdsStatement.java:966) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.cleanupUncachedStatements(NewPooledConnection.java:718) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:592) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 
Caused by: java.io.IOException: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:755) 
    at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477) 
    at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114) 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2282) 
    ... 9 more 

11월 30, 2012 4:39:59 오후 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask run 
WARNING: Failed to destroy resource: [email protected] 
java.sql.SQLException: Some resources failed to close properly while closing [email protected] 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:638) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 

11월 30, 2012 4:42:17 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] Exceptions occurred while trying to close a PooledConnection's resources normally. 
11월 30, 2012 4:42:17 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] NewPooledConnection close Exception. 
java.sql.SQLException: I/O Error: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2388) 
    at net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:736) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.reset(JtdsStatement.java:722) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.close(JtdsStatement.java:966) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.cleanupUncachedStatements(NewPooledConnection.java:718) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:592) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 
Caused by: java.io.IOException: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:755) 
    at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477) 
    at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114) 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2282) 
    ... 9 more 

11월 30, 2012 4:42:17 오후 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask run 
WARNING: Failed to destroy resource: [email protected] 
java.sql.SQLException: Some resources failed to close properly while closing [email protected] 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:638) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 

11월 30, 2012 4:42:17 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] Exceptions occurred while trying to close a PooledConnection's resources normally. 
11월 30, 2012 4:42:17 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] NewPooledConnection close Exception. 
java.sql.SQLException: I/O Error: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2388) 
    at net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:736) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.reset(JtdsStatement.java:722) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.close(JtdsStatement.java:966) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.cleanupUncachedStatements(NewPooledConnection.java:718) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:592) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 
Caused by: java.io.IOException: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:755) 
    at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477) 
    at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114) 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2282) 
    ... 9 more 

11월 30, 2012 4:42:17 오후 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask run 
WARNING: Failed to destroy resource: [email protected] 
java.sql.SQLException: Some resources failed to close properly while closing [email protected] 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:638) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 

11월 30, 2012 4:42:18 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] Exceptions occurred while trying to close a PooledConnection's resources normally. 
11월 30, 2012 4:42:18 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] NewPooledConnection close Exception. 
java.sql.SQLException: I/O Error: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2388) 
    at net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:736) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.reset(JtdsStatement.java:722) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.close(JtdsStatement.java:966) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.cleanupUncachedStatements(NewPooledConnection.java:718) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:592) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 
Caused by: java.io.IOException: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:755) 
    at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477) 
    at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114) 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2282) 
    ... 9 more 

11월 30, 2012 4:42:18 오후 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask run 
WARNING: Failed to destroy resource: [email protected] 
java.sql.SQLException: Some resources failed to close properly while closing [email protected] 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:638) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 

11월 30, 2012 4:42:19 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] Exceptions occurred while trying to close a PooledConnection's resources normally. 
11월 30, 2012 4:42:19 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] NewPooledConnection close Exception. 
java.sql.SQLException: I/O Error: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2388) 
    at net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:736) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.reset(JtdsStatement.java:722) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.close(JtdsStatement.java:966) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.cleanupUncachedStatements(NewPooledConnection.java:718) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:592) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 
Caused by: java.io.IOException: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:755) 
    at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477) 
    at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114) 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2282) 
    ... 9 more 

11월 30, 2012 4:42:19 오후 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask run 
WARNING: Failed to destroy resource: [email protected] 
java.sql.SQLException: Some resources failed to close properly while closing [email protected] 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:638) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 

11월 30, 2012 4:42:21 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] Exceptions occurred while trying to close a PooledConnection's resources normally. 
11월 30, 2012 4:42:21 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] NewPooledConnection close Exception. 
java.sql.SQLException: I/O Error: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2388) 
    at net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:736) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.reset(JtdsStatement.java:722) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.close(JtdsStatement.java:966) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.cleanupUncachedStatements(NewPooledConnection.java:718) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:592) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 
Caused by: java.io.IOException: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:755) 
    at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477) 
    at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114) 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2282) 
    ... 9 more 

11월 30, 2012 4:42:21 오후 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask run 
WARNING: Failed to destroy resource: [email protected] 
java.sql.SQLException: Some resources failed to close properly while closing [email protected] 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:638) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 

11월 30, 2012 4:42:22 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] Exceptions occurred while trying to close a PooledConnection's resources normally. 
11월 30, 2012 4:42:22 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] NewPooledConnection close Exception. 
java.sql.SQLException: I/O Error: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2388) 
    at net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:736) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.reset(JtdsStatement.java:722) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.close(JtdsStatement.java:966) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.cleanupUncachedStatements(NewPooledConnection.java:718) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:592) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 
Caused by: java.io.IOException: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:755) 
    at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477) 
    at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114) 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2282) 
    ... 9 more 

11월 30, 2012 4:42:22 오후 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask run 
WARNING: Failed to destroy resource: [email protected] 
java.sql.SQLException: Some resources failed to close properly while closing [email protected] 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:638) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 

11월 30, 2012 4:42:22 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] Exceptions occurred while trying to close a PooledConnection's resources normally. 
11월 30, 2012 4:42:22 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] NewPooledConnection close Exception. 
java.sql.SQLException: I/O Error: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2388) 
    at net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:736) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.reset(JtdsStatement.java:722) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.close(JtdsStatement.java:966) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.cleanupUncachedStatements(NewPooledConnection.java:718) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:592) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 
Caused by: java.io.IOException: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:755) 
    at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477) 
    at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114) 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2282) 
    ... 9 more 

11월 30, 2012 4:42:22 오후 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask run 
WARNING: Failed to destroy resource: [email protected] 
java.sql.SQLException: Some resources failed to close properly while closing [email protected] 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:638) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 

11월 30, 2012 4:42:22 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] Exceptions occurred while trying to close a PooledConnection's resources normally. 
11월 30, 2012 4:42:22 오후 com.mchange.v2.c3p0.impl.NewPooledConnection logCloseExceptions 
INFO: [c3p0] NewPooledConnection close Exception. 
java.sql.SQLException: I/O Error: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2388) 
    at net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:736) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.reset(JtdsStatement.java:722) 
    at net.sourceforge.jtds.jdbc.JtdsStatement.close(JtdsStatement.java:966) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.cleanupUncachedStatements(NewPooledConnection.java:718) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:592) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 
Caused by: java.io.IOException: Stream 2 attempting to read when no request has been sent 
    at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:755) 
    at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477) 
    at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114) 
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2282) 
    ... 9 more 

11월 30, 2012 4:42:22 오후 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask run 
WARNING: Failed to destroy resource: [email protected] 
java.sql.SQLException: Some resources failed to close properly while closing [email protected] 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:638) 
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) 
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) 
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) 
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 

在此先感谢。 让我知道,如果有几点我可以改善写一个问题:)

编辑 哎呀我忘了粘贴我的配置。这里去

<hibernate-configuration> 

<session-factory> 

<!-- Database connection settings --> 
<property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property> 
<!-- --> 

<!-- JDBC connection pool (use the built-in) --> 
<property name="connection.pool_size">5</property> 

<!-- connection pooling --> 

     <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> 
     <!-- 
     <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>   
     --> 
     <property name="hibernate.c3p0.acquire_increment" >1</property> 
     <property name="hibernate.c3p0.idle_test_period">30</property> 
     <property name="hibernate.c3p0.min_size">1</property> 
     <property name="hibernate.c3p0.max_size">2</property> 
     <property name="hibernate.c3p0.max_statements">50</property> 
     <property name="hibernate.c3p0.timeout">60</property> 

     <!-- 
     <property name="hibernate.c3p0.acquireRetryAttempts">1</property> 
     <property name="hibernate.c3p0.acquireRetryDelay">250</property> 
     --> 

<!-- SQL dialect --> 
<!-- 
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property> 
--> 

<!-- Enable Hibernate's automatic session context management --> 
<property name="current_session_context_class">thread</property> 

<!-- Disable the second-level cache --> 
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> 

<!-- Echo all executed SQL to stdout --> 
<property name="show_sql">true</property> 

<!-- Drop and re-create the database schema on startup --> 
<!-- <property name="hbm2ddl.auto">update</property> --> 

<!-- Mapping files --> 
<mapping resource="standard.hbm.xml"/> 
<mapping resource="revisionedFile.hbm.xml"/> 
<mapping resource="keyword.hbm.xml"/> 
<mapping resource="device.hbm.xml"/> 
<mapping resource="reference.hbm.xml"/> 
<mapping resource="commonSpecification.hbm.xml"/> 
<mapping resource="item.hbm.xml"/> 
<mapping resource="superItem.hbm.xml"/> 
<mapping resource="defaultURLResource.hbm.xml" /> 
<mapping resource="test.hbm.xml"/> 

    <!-- Enver Listeners --> 
    <listener class="org.hibernate.envers.event.AuditEventListener" type="post-insert"/> 
    <listener class="org.hibernate.envers.event.AuditEventListener" type="post-update"/> 
    <listener class="org.hibernate.envers.event.AuditEventListener" type="post-delete"/> 
    <listener class="org.hibernate.envers.event.AuditEventListener" type="pre-collection-update"/> 
    <listener class="org.hibernate.envers.event.AuditEventListener" type="pre-collection-remove"/> 
    <listener class="org.hibernate.envers.event.AuditEventListener" type="post-collection-recreate"/> 


</session-factory> 

</hibernate-configuration> 

回答

2

我完全不知道为什么你看到的例外,但他们是例外情况C3P0正在清理语句应该已经被用户关闭,但并非如此。解决问题的一种方法(可以解决问题或给出有关问题发生位置的更清晰的信息)将确保您的客户端应用程序在使用它们后立即关闭语句。 c3p0在签入Connections时(或者在从池中删除PooledConnection时)会小心地为您清理未关闭的语句,但是如果发生异常,它们将在资源调配过程中作为异常报告,清理,即关闭()期间。这就是你所看到的。

在PooledConnection被破坏的时候,如何/为什么还有未缓存的语句被关闭,这有点神秘。池在检出时不应尝试关闭()PooledConnection,并且如果它已签入,则应在检入时清除语句。我将在记录器com.mchange.v2.c3p0.impl.NewPooledConnection上添加更多的日志记录(在FINER/DEBUG级别)到下一个预先发布的c3p0,这可能有助于跟踪这个问题。如果你有机会,请确认一下。

+0

哇我在c3p0网站上看到了你的名字!谢谢你的时间。我绝对会检查c3p0的下一个版本。伟大的作品!如果你有兴趣,我可以给你更详细的问题。有没有可以提交问题的地方? – Ascendant

+0

我很高兴发送快照!在mchange.com发邮件给我,swaldman –