日期:2014-05-18  浏览次数:20837 次

MySql+Hibernate+Resin的错误
这个系统在resin服务器启动时是好的!但是过了一夜就坏了!
autoReconnect=true已经在hibernate的连接字符串已经加了!
我的hibernate的sessionFactory是一个静态的成员,可能就是这个sf关闭引起的!!!
现在不知道怎么处理!
一些人认为是mysql在长时间没有连接后(8h)就会自动关闭连接!

java.sql.SQLException:   No   operations   allowed   after   connection   closed.Connection
was   implicitly   closed   due   to   underlying   exception/error:


**   BEGIN   NESTED   EXCEPTION   **  

com.mysql.jdbc.CommunicationsException
MESSAGE:   Communications   link   failure   due   to   underlying   exception:  

**   BEGIN   NESTED   EXCEPTION   **  

java.io.EOFException

STACKTRACE:

java.io.EOFException
at   com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1902)
at   com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2348)
at   com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2858)
at   com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
at   com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at   com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
at   com.mysql.jdbc.Connection.commit(Connection.java:2147)
at   org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:139)
at   org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:115)
at   cn.edu.nwsuaf.wwf.util.HibernateUtil.commitTransaction(HibernateUtil.java:263)
at   cn.edu.nwsuaf.wwf.servlet.HibernateFilter.doFilter(HibernateFilter.java:42)
at   com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:73)
at   com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:167)
at   com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:226)
at   com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:424)
at   com.caucho.server.port.TcpConnection.run(TcpConnection.java:477)
at   com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:591)
at   com.caucho.util.ThreadPool$Item.run(ThreadPool.java:513)
at   java.lang.Thread.run(Thread.java:595)


**   END   NESTED   EXCEPTION   **


Last   packet   sent   to   the   server   was   16   ms   ago.

STACKTRACE:

com.mysql.jdbc.CommunicationsException:   Communications   link   failure   due
to   underlying   exception:  

**   BEGIN   NESTED   EXCEPTION   **  

java.io.EOFException

STACKTRACE:

java.io.EOFException
at   com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1902)
at   com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2348)
at   com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2858)
at   com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
at   com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at   com.mysql.jdbc.Connection.execSQL(Connection.java