Hibernate: Communication link failure: java.io.IOException

I recently launched a new site based on Struts, Hibernate and MySQL and immediately ran into a weird issue where Hibernate lost the ability to make database connections after a long period of inactivity. For the record, the stack trace is below:

java.sql.SQLException: Communication link failure: java.io.IOException
  at org.gjt.mm.mysql.MysqlIO.sendCommand(Unknown Source)
  at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(Unknown Source)
  at org.gjt.mm.mysql.Connection.execSQL(Unknown Source)
  at org.gjt.mm.mysql.PreparedStatement.executeQuery(Unknown Source)
  at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:83)
  at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:794)
  at net.sf.hibernate.hql.QueryTranslator.iterate(QueryTranslator.java:846)
  at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1540)
  at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1513)
  at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1505)

Looks like there are other people having the same problem, the first suggestion was to use the Thread Local Session pattern, which I already had in place. The solution was to add the following properties to my hibernate.cfg.xml:

<property name="connection.autoReconnect">true</property>
<property name="connection.autoReconnectForPools">true</property>
<property name="connection.is-connection-validation-required">true</property>

which I believe are specific to MySQL, but as far as I can tell, aren’t documented anywhere on the Hibernate site (or should they be documented on the MySQL JDBC driver site?)

For what it’s worth, Hibernate is a dream come true. I don’t like writing create, update, and delete SQL statements and I’ve found that the software I’ve written is much easier to manage and troubleshoot. If you haven’t played with it yet, check it out now.

21 thoughts on “Hibernate: Communication link failure: java.io.IOException”

  1. I had the same problem with commons pooling/dhcp. I switched to use the datasource built in to Resin and the problem never came back. Which pooling lib are you using?

  2. im using c3po, hibernate/spring /qwatrz, .. i encountered a deadlock situation, will that reconnect cause hibernate to reconnect to the database using my specified connection pool?? or does that apply only to the default connection pool(which was not suppose to be used in production)..anyone? thx

  3. I am been struggling with problem for the past few days.

    My application is not able to recover from lost db connection.

    I use hibernate 2.1 to connect to MySQL 4.0.18.

    Can you help me with some illustrative examples to overcome the problem.

  4. I had the same issue. I was using Hibernate 2.1 to connect to mysql and the JDBC driver was version 3.x. Just putting the properties described above in the xml file did not work for me.

    Here is what I had to do —
    – Downgrade the driver to 2.x series
    – Put the following properties in my hibernate configuration file for the c3p0 connection pool —

    true
    true

    true

    ALSO, there is a trick that I found. You donot need to wait overnight to test if the fix worked. I opened the mysql administrator, in that, you can delete all the connections to your database. So I would go in my product, make a connection, and then drop the connection from DB. And try to reconnect without restarting my servers and that worked. This did not use to work before downgrading the drivers and putting the properties.

    I also tried to do just the properties and just downgrading, but that did not work either. Its the combination that works !!!!

    Hope this helps !!

  5. Too bad. It didnot take the properties.

    connection.autoReconnect -> true
    connection.autoReconnectForPools-> true
    connection.is-connection-validation-required -> true

  6. There are a few solutions to this problem. But you should first check out this discussion:
    http://lists.mysql.com/java/8119

    I’m building a similiar application with Struts, Hibertnate and MySQL and deploying it to JBoss & Websphere.

    As a quick fix, one solution is of course to increase the “wait_timeout” of MySQL to some ridiculous number.

    A better fix would be to use the connection pool to test for idle connections and then reconnect when they are no longer present or stale.
    I’m using C3P0 to handle my connection pooling with Hibernate. You need to adjust C3P0’s settings so that test the connection before the wait_timeout of MySQL.
    As an example, here is are my C3P0 settings in my hibernate.cfg.xml file:

    <property name="c3p0.min_size">10</property>
    <property name="c3p0.max_size">100</property>
    <property name="c3p0.timeout">18000</property>
    <property name="c3p0.acquireRetryAttempts">30</property>

    <property name="c3p0.acquireIncrement">5</property>
    <property name="c3p0.automaticTestTable">C3P0TestTable</property>

    <property name="c3p0.idleConnectionTestPeriod">36000</property>

    <property name="c3p0.initialPoolSize">20</property>
    <property name="c3p0.maxPoolSize">100</property>
    <property name="c3p0.maxIdleTime">1200</property>
    <property name="c3p0.maxStatements">50</property>
    <property name="c3p0.minPoolSize">10</property>

    So far, after doing this, I haven’t had a problem. You should read up on C3P0 and adjust the settings to fit your application.
    –KaChang

  7. ?autoReconnect=true doesn’t do the trick for me on mySQL4.1.10 and using mysql-connector-java-3.0.15-ga-
    bin.jar

    Marc

  8. I ‘m facing the same problem but I’m not using any application servers but just a small Java Application. The application couldn’t connect to the MySQL server. I’m running it in WinXP environment. Can anybody have ideas what cause the problem?

  9. sorry. the setMaxResult() is fixed in the latest development version so I think it is not included yet in the lastest production version.
    So i think i have to use Chhean’s solution. Thanks

  10. Once again…

    Dudes i’ve the solution! I’ve had the same problems! Here is the REAL solution: At first you should know, that there are two problems: Hibernates and Tomcat. Hibernate gets after a time of inactivity idle connections and tomcats authentication mechanism (default= JDBCRealm) gets also idle connections. So this are two problems. The solution to eliminate both problems is to use a JNDI DataSource, that handles our database connections. It is an abstraction level above and so the software engineer does not have to care about idle connections, becausenow we get the connections out of a connection pool. And if we use a JNDI DataSource, hibernate and tomcat could use the same ConnectionPool!
    hibernate.cfg.xml:
    <?xml version=’1.0′ encoding=’utf-8′?>
    <!DOCTYPE hibernate-configuration PUBLIC
    “-//Hibernate/Hibernate Configuration DTD//EN”
    “http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd”>

    <hibernate-configuration>
    <session-factory>
    <property name=”hibernate.connection.datasource”>java:/comp/env/jdbc/myapplication</property>
    <property name=”hibernate.setup”>true</property>
    <property name=”dialect”>org.hibernate.dialect.MySQLDialect</property>
    <property name=”show_sql”>false</property>

    </session-factory>
    </hibernate-configuration>

    server.xml:
    <Context path=”/myapplication” docBase=”D:\Programs\tomcat5.5test\webapps\myapplication”
    debug=”5″ reloadable=”true” crossContext=”true”>

    <Resource name=”jdbc/myapplication” auth=”Container” type=”javax.sql.DataSource”
    maxActive=”100″ maxIdle=”30″ maxWait=”10000″
    username=”myuser” password=”mypass” driverClassName=”com.mysql.jdbc.Driver”
    url=”jdbc:mysql://10.42.69.20/test?autoReconnect=true”/>

    <Realm className=”org.apache.catalina.realm.DataSourceRealm” debug=”99″
    dataSourceName=”jdbc/myapplication”
    userTable=”users” userNameCol=”_userName” userCredCol=”_password” localDataSource=”true”
    userRoleTable=”user_roles” roleNameCol=”_role” digest=”SHA”/>

    </Context>

    web.xml:
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/myapplication</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>

    And don’t forget to copy mysql-connector-java-3.1.11-bin.jar into %CATALINA_HOME%\common\lib !!!

    This solved ALL my problems with the MySQL-DB!

  11. @Markus,

    thx for your solution with JNDI Datasource. I had the exact same problem using struts, hibernate and tomcat, ie. hibernates inability to reconnect after about 8 hours. letting tomcats datasource service manage the connections did the job!

  12. could u please tell me the same configuration for JBoss not the TomCat? i am experiencing the same problem of connection closing with Struts, Hibernate, MySql and JBoss

  13. I have a JNDI datasource in JBoss and everything works, it destroys invalid connections:

    2006-10-10 00:08:18,394 WARN [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory] Destroying connection that is not valid, due to the following exception: com.mysql.jdbc.Connection@1fbaf73
    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:1395)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1539)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1930)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
    at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1225)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2278)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2225)
    at com.mysql.jdbc.Statement.execute(Statement.java:906)
    at org.jboss.resource.adapter.jdbc.CheckValidConnectionSQL.isValidConnection(CheckValidConnectionSQL.java:44)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnectionFactory.isValidConnection(BaseWrapperManagedConnectionFactory.java:367)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.checkValid(BaseWrapperManagedConnection.java:212)
    at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.matchManagedConnections(LocalManagedConnectionFactory.java:186)
    at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:167)
    at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:566)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:410)
    at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:342)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:462)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:894)
    at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:73)
    at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
    at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:292)
    at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3373)
    at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3333)
    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.doList(Loader.java:1063)
    at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
    at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
    at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3660)
    at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
    at lv.idega.txgateway.persistence.implementations.HibernatePersistenceService.searchTransactionsToUpdateStatus(HibernatePersistenceService.java:141)
    at lv.idega.txgateway.ejb.TransactionStatusUpdaterBean.updateTransactionStatuses(TransactionStatusUpdaterBean.java:144)
    at lv.idega.txgateway.ejb.TransactionStatusUpdaterBean.ejbTimeout(TransactionStatusUpdaterBean.java:128)
    at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
    at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
    at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
    at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:389)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
    at org.jboss.ejb.Container.invoke(Container.java:873)
    at org.jboss.ejb.txtimer.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:82)
    at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:473)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)

    ** END NESTED EXCEPTION **

    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1714)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1930)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
    at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1225)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2278)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2225)
    at com.mysql.jdbc.Statement.execute(Statement.java:906)
    at org.jboss.resource.adapter.jdbc.CheckValidConnectionSQL.isValidConnection(CheckValidConnectionSQL.java:44)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnectionFactory.isValidConnection(BaseWrapperManagedConnectionFactory.java:367)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.checkValid(BaseWrapperManagedConnection.java:212)
    at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.matchManagedConnections(LocalManagedConnectionFactory.java:186)
    at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:167)
    at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:566)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:410)
    at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:342)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:462)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:894)
    at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:73)
    at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
    at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:292)
    at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3373)
    at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3333)
    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.doList(Loader.java:1063)
    at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
    at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
    at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3660)
    at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
    at lv.idega.txgateway.persistence.implementations.HibernatePersistenceService.searchTransactionsToUpdateStatus(HibernatePersistenceService.java:141)
    at lv.idega.txgateway.ejb.TransactionStatusUpdaterBean.updateTransactionStatuses(TransactionStatusUpdaterBean.java:144)
    at lv.idega.txgateway.ejb.TransactionStatusUpdaterBean.ejbTimeout(TransactionStatusUpdaterBean.java:128)
    at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
    at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
    at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
    at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:389)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
    at org.jboss.ejb.Container.invoke(Container.java:873)
    at org.jboss.ejb.txtimer.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:82)
    at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:473)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)
    2006-10-10 00:08:18,397 WARN [org.jboss.resource.connectionmanager.TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@1273085[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@bbe282 handles=0 lastUse=1160427198848 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@1e668c2 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@1e7a4d0 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@113cd63 txSync=null]
    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:1395)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1539)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1930)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
    at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1225)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2278)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2225)
    at com.mysql.jdbc.Statement.execute(Statement.java:906)
    at org.jboss.resource.adapter.jdbc.CheckValidConnectionSQL.isValidConnection(CheckValidConnectionSQL.java:44)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnectionFactory.isValidConnection(BaseWrapperManagedConnectionFactory.java:367)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.checkValid(BaseWrapperManagedConnection.java:212)
    at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.matchManagedConnections(LocalManagedConnectionFactory.java:186)
    at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:167)
    at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:566)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:410)
    at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:342)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:462)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:894)
    at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:73)
    at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
    at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:292)
    at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3373)
    at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3333)
    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.doList(Loader.java:1063)
    at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
    at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
    at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3660)
    at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
    at lv.idega.txgateway.persistence.implementations.HibernatePersistenceService.searchTransactionsToUpdateStatus(HibernatePersistenceService.java:141)
    at lv.idega.txgateway.ejb.TransactionStatusUpdaterBean.updateTransactionStatuses(TransactionStatusUpdaterBean.java:144)
    at lv.idega.txgateway.ejb.TransactionStatusUpdaterBean.ejbTimeout(TransactionStatusUpdaterBean.java:128)
    at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
    at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
    at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
    at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:389)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
    at org.jboss.ejb.Container.invoke(Container.java:873)
    at org.jboss.ejb.txtimer.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:82)
    at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:473)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)

    ** END NESTED EXCEPTION **

    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1714)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1930)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
    at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1225)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2278)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2225)
    at com.mysql.jdbc.Statement.execute(Statement.java:906)
    at org.jboss.resource.adapter.jdbc.CheckValidConnectionSQL.isValidConnection(CheckValidConnectionSQL.java:44)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnectionFactory.isValidConnection(BaseWrapperManagedConnectionFactory.java:367)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.checkValid(BaseWrapperManagedConnection.java:212)
    at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.matchManagedConnections(LocalManagedConnectionFactory.java:186)
    at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:167)
    at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:566)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:410)
    at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:342)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:462)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:894)
    at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:73)
    at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
    at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:292)
    at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3373)
    at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3333)
    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.doList(Loader.java:1063)
    at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
    at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
    at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3660)
    at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
    at lv.idega.txgateway.persistence.implementations.HibernatePersistenceService.searchTransactionsToUpdateStatus(HibernatePersistenceService.java:141)
    at lv.idega.txgateway.ejb.TransactionStatusUpdaterBean.updateTransactionStatuses(TransactionStatusUpdaterBean.java:144)
    at lv.idega.txgateway.ejb.TransactionStatusUpdaterBean.ejbTimeout(TransactionStatusUpdaterBean.java:128)
    at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
    at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
    at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
    at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:389)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
    at org.jboss.ejb.Container.invoke(Container.java:873)
    at org.jboss.ejb.txtimer.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:82)
    at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:473)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)
    2006-10-10 00:08:18,398 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Destroying connection that could not be successfully matched: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@1273085[state=DESTROYED mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@bbe282 handles=0 lastUse=1160427198848 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@1e668c2 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@1e7a4d0 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@113cd63 txSync=null]

  14. Hi,
    I am getting the same issue for hibernate 2.1. Is there any solution for this for hibernate 2.1?

    Vinod

Leave a Reply

Your email address will not be published. Required fields are marked *