Maybe hibernate, maybe c3p0....
I've been finding the below exception message in my logs. Note that there are no references to my code anywhere in the stack (so I have no idea where to start writing a test case to reproduce it) and there are no exceptions ever propagating up to my code. The app continues running (happily?) when these occur; they appear to be internal exceptions that get "dealt with" by hibernate/c3p0.
Any help identifying the cause and a way to prevent they from happening would be greatly appreciated. They are adding scary noise to the log files that I'd rather live without.
Hibernate version:
2.1
mysql-connector-java-3.1.7
c3p0-0.8.5.2
Mapping documents: No idea which one of ~20 might be involved
Code between sessionFactory.openSession() and session.close(): Using a standard dao idiom as described in the docs. If I knew where this was happening I'd quote that specific one, but. :-/
Full stack trace of any exception that occurs:
Code:
Failed to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@1d1c3cd
java.lang.NullPointerException
at com.mysql.jdbc.ServerPreparedStatement.realClose(ServerPreparedStatement.java:1095)
at com.mysql.jdbc.Connection.closeAllOpenStatements(Connection.java:2885)
at com.mysql.jdbc.Connection.realClose(Connection.java:2092)
at com.mysql.jdbc.Connection.close(Connection.java:1066)
at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:326)
at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:115)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.destroyResource(C3P0PooledConnectionPool.java:185)
at com.mchange.v2.resourcepool.BasicResourcePool$5.run(BasicResourcePool.java:576)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:354)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main] -- caught unexpected Exception while executing posted task.
java.lang.NullPointerException
at com.mysql.jdbc.ServerPreparedStatement.realClose(ServerPreparedStatement.java:1095)
at com.mysql.jdbc.ServerPreparedStatement.close(ServerPreparedStatement.java:712)
at com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:38)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache$1.run(GooGooStatementCache.java:246)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:354)
Name and version of the database you are using:
MySQL 4.1.11
The generated SQL (show_sql=true): The code can run for a long time before this error occurs; it would be unweildy to run in this mode in production until it happened.
Debug level Hibernate log excerpt:
Dittos. Sorry.