I asked the following question on the Hibernate Forums, but thought I'd put it here to see if anyone can help.
I'm using the open-session-in-view pattern and getting the following error at random:
2003-08-21 07:00:08,873 WARN [Thread-27] JDBCExceptionReporter.logExceptions(38) | SQL Error: 0, SQLState: 08003 2003-08-21 07:00:08,874 ERROR [Thread-27] JDBCExceptionReporter.logExceptions(46 ) | No operations allowed after connection closed 2003-08-21 07:00:08,875 ERROR [Thread-27] JDBCException.(37) | Could not execute query java.sql.SQLException: No operations allowed after connection closed at com.mysql.jdbc.Connection.checkClosed(Connection.java:2497) at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1287) at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1267) at org.apache.commons.dbcp.DelegatingConnection.prepareStatement (DelegatingConnection.java:187) at net.sf.hibernate.impl.SessionFactoryImpl.getPreparedStatement (SessionFactoryImpl.java:537) at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:56) at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:482) at net.sf.hibernate.loader.Loader.doFind(Loader.java:136) at net.sf.hibernate.loader.Loader.find(Loader.java:620)
I've used my same ServiceLocator.java class for the past 6 months on a couple of different projects (MySQL and Oracle), with no issues. But now I've developed a new app for a new client, and this error is popping up a LOT. Any ideas? I'm only closing the connection after my doFilter() method in a Filter.
It doesn't happen at all on my Windows XP machine (I've never seen the error). Only on Linux.
uname -a gives me:
Linux kgb08 2.4.20-8bigmem #1 SMP Thu Mar 13 17:32:29 EST 2003 i686 i686 i386 GNU/Linux
Tomcat 4.1.27, MySQL 4.0.13-Max-log, JDBC Driver mysql-connector-java-3.0.8-stable-bin.jar.
I've also seen it happen on MySQL 3.23.56, but now I can't seem to reproduce it.