Hibernate: Communication Link Failure: java.io.ioException

xiaoxiao2021-03-14  221

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 (loadinger.java: 794) at net.sf.hibernate.hql.QueryTranslator.iseTe (querytranslator.java: 846) at net.sf.hibernate.impl.sessionImpl.Inder (sessionImpl.java: 1540 ) At Net.sf.hibernate.impl.Session IIPL.Ist (sessionImpl.java: 1513) at Net.sf.hibernate.impl.Session IITERATE (sessionimpl.java: 1505) Looks Like there Are Othe r 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:. true true true which I believe are specific to MySQL , but as far as I can tell, aren't docutented anywhere on the Hibernate Site (or Should The Be Documented on The MySQL JDBC Driver Site?)

转载请注明原文地址:https://www.9cbs.com/read-129366.html

New Post(0)