MySQL Problem: No operations allowed after connection closed
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.
Any ideas?
Posted by Chris Nokleberg on August 21, 2003 at 04:30 PM MDT #
Posted by Tim on August 21, 2003 at 08:08 PM MDT #
Posted by Mark Matthews on August 21, 2003 at 08:20 PM MDT #
Look at the example for MySQL in this doc
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
Specifically the connection url.
I banged my head on this one for quite a while
Posted by Steven Citron-Pousty on August 22, 2003 at 12:06 AM MDT #
Posted by Matt Raible on August 22, 2003 at 03:06 AM MDT #
Thanks for your reply on the Hibernate forums. I downloaded the nightly build you recommended - and amazingly enough, haven't had a problem since. I asked my client to notify me if they'd seen any of the "No operations allowed after connection closed" errors, but haven't heard from them at all. I've clicked around their site a few times today, and no errors have popped up. With the 3.0.8 driver, the error would crop up every 4th click. Looks like you fixed something. Thanks - much appreciated! ;-)
Posted by Matt Raible on August 23, 2003 at 04:23 AM MDT #
Posted by Rafe on August 23, 2003 at 10:33 PM MDT #
Posted by Rafe on August 27, 2003 at 02:58 PM MDT #
Posted by Gavin on August 28, 2003 at 10:47 PM MDT #
Posted by atog on September 17, 2003 at 09:44 PM MDT #
Posted by Loren on October 20, 2003 at 05:10 PM MDT #