简体   繁体   中英

Hibernate 4 + C3P0 connection pooling returns errors

I'm using Hibernate 4 with C3P0 as its connection provider. I'm currently not using Spring framework.

Dev Environment

Windows 7
Eclipse Juno
JRE-7
JDK -7

jars Im using are...

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

but in the same lib path there are also

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

Is there any chance those other jars(hibernate-c3p0-4.1.1.Final.jar and spring-orm-3.2.0.RC1.jar) might have had some effect on this error (see below) ??

And yes the whole spring framework jars are in the path but I'm just trying to get used to hibernate first. I don't really know how to use Spring yet. Let's leave that matter here for now.

I can create connections and query successfully against the database. But I get this error

something like

Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@4d0106e5

and

WARNING: Failed to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@4d0106e5

The errors I get are pretty repetitive. They all look like this

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: com.mchange.v2.c3p0.impl.NewPooledConnection@4d0106e5
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@4d0106e5
    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: com.mchange.v2.c3p0.impl.NewPooledConnection@40a4d015
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@40a4d015
    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: com.mchange.v2.c3p0.impl.NewPooledConnection@2ee657fa
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@2ee657fa
    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: com.mchange.v2.c3p0.impl.NewPooledConnection@51b2f91b
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@51b2f91b
    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: com.mchange.v2.c3p0.impl.NewPooledConnection@7bb39e5e
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@7bb39e5e
    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: com.mchange.v2.c3p0.impl.NewPooledConnection@155767ad
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@155767ad
    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: com.mchange.v2.c3p0.impl.NewPooledConnection@299bdc58
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@299bdc58
    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: com.mchange.v2.c3p0.impl.NewPooledConnection@550a9854
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@550a9854
    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: com.mchange.v2.c3p0.impl.NewPooledConnection@67a80f8e
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@67a80f8e
    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)

Thanks in advance. Let me know if there are few points I can improve writing a question : )

EDIT Oops I forgot to paste my config. Here goes

<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>  

i don't know exactly why you are seeing the Exceptions, but they are Exceptions where c3p0 is cleaning up Statements that ought to have been closed by the user but were not. one way to address the issue (which would either solve the problem or give you cleaner information about where the problem occurs) would be to make sure that your client application closes Statements promptly after it uses them. c3p0 is careful to clean up unclosed Statements for you when you check in Connections (or in this case, when a PooledConnection is being removed from the pool), but if Exceptions occur when it does, they will be reported as an Exception during resource-cleanup, ie during close(). that's what you are seeing.

it's a bit of a mystery how/why you have uncached Statements remaining to be closed while the PooledConnection is being destroyed. the pool shouldn't try to close() a PooledConnection while it is checked out, and if it has been checked in, the Statements ought to have been cleaned up on check-in. i'll add a bit more logging (at FINER/DEBUG level) to the logger com.mchange.v2.c3p0.impl.NewPooledConnection to the next pre-release of c3p0 that might help to track this issue down. please do give it a look if you get a chance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM