Hi,
now has a java app program access mysql 4.0.x DB use hibernate 2, sometimes will hit following error.
It seems the hibernate loss the DB connection after a interval sleep time.
how the hibernate handle the connection pool ?
any advice to solve the problem?
thanks
hibernate config
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/mms_gw?useUnicode=true&characterEncoding=Utf8</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<property name="connection.autoReconnect">true</property>
exception:
Caused by: net.sf.hibernate.exception.GenericJDBCException: could not load: [com.haoxi.gw.mms.entity.WaitSendRequest#18736]
at net.sf.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:90)
at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:79)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at net.sf.hibernate.persister.AbstractEntityPersister.convert(AbstractEntityPersister.java:1331)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:416)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2131)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2001)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1930)
at com.haoxi.gw.util.BaseDAO.findById(BaseDAO.java:169)
... 5 more
Caused by: java.sql.SQLException: No operations allowed after connection closed.
Connection was closed due to the following exception:
** BEGIN NESTED EXCEPTION **
java.sql.SQLException
MESSAGE: Communication link failure: java.io.EOFException, underlying cause: null
** BEGIN NESTED EXCEPTION **
java.io.EOFException
STACKTRACE:
java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1319)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1463)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1854)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1109)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1203)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2090)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1496)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:89)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:880)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:273)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:941)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:961)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:413)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2131)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2001)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1930)
at com.haoxi.gw.util.BaseDAO.findById(BaseDAO.java:169)
at com.haoxi.gw.mms.dao.WaitSendRequestDAO.load(WaitSendRequestDAO.java:55)
at com.haoxi.gw.mms.bl.WaitSendRequestBL.findWaitSendRequest(WaitSendRequestBL.java:36)
at com.haoxi.gw.mms.d.zte.MmsZteSubmit.submitAfter(MmsZteSubmit.java:78)
at com.haoxi.gw.mms.d.MmsSubmitTask.doJob(MmsSubmitTask.java:27)
at com.haoxi.gw.util.threadpool.MainThread$ChildThread.run(MainThread.java:198)
** END NESTED EXCEPTION **
STACKTRACE:
java.sql.SQLException: Communication link failure: java.io.EOFException, underlying cause: null
** BEGIN NESTED EXCEPTION **
java.io.EOFException
STACKTRACE:
java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1319)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1463)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1854)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1109)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1203)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2090)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1496)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:89)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:880)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:273)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:941)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:961)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:413)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2131)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2001)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1930)
at com.haoxi.gw.util.BaseDAO.findById(BaseDAO.java:169)
at com.haoxi.gw.mms.dao.WaitSendRequestDAO.load(WaitSendRequestDAO.java:55)
at com.haoxi.gw.mms.bl.WaitSendRequestBL.findWaitSendRequest(WaitSendRequestBL.java:36)
at com.haoxi.gw.mms.d.zte.MmsZteSubmit.submitAfter(MmsZteSubmit.java:78)
at com.haoxi.gw.mms.d.MmsSubmitTask.doJob(MmsSubmitTask.java:27)
at com.haoxi.gw.util.threadpool.MainThread$ChildThread.run(MainThread.java:198)
** END NESTED EXCEPTION **
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1638)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1854)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1109)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1203)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2090)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1496)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:89)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:880)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:273)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:941)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:961)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:413)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2131)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2001)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1930)
at com.haoxi.gw.util.BaseDAO.findById(BaseDAO.java:169)
at com.haoxi.gw.mms.dao.WaitSendRequestDAO.load(WaitSendRequestDAO.java:55)
at com.haoxi.gw.mms.bl.WaitSendRequestBL.findWaitSendRequest(WaitSendRequestBL.java:36)
at com.haoxi.gw.mms.d.zte.MmsZteSubmit.submitAfter(MmsZteSubmit.java:78)
at com.haoxi.gw.mms.d.MmsSubmitTask.doJob(MmsSubmitTask.java:27)
at com.haoxi.gw.util.threadpool.MainThread$ChildThread.run(MainThread.java:198)
** END NESTED EXCEPTION **
at com.mysql.jdbc.Connection.checkClosed(Connection.java:2225)
at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1313)
at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1293)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:263)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:236)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:67)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:784)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:941)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:961)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:413)
... 9 more
|