c3p 连接myslq问题 导致服务器宕机
hibernate+c3p 连接mysql,linux 过一段时间服务器就宕机。无法做任何操纵。
我的连接池配置文件:
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.url">jdbc:mysql://127.0.0.1:3306? useUnicode=true&characterEncoding=gbk</property>
<property name="connection.username">mysql</property>
<property name="connection.password">mingtianzaishuo</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="myeclipse.connection.profile">chen</property>
<property name="show_sql">true</property>
<property name="connection.release_mode">auto</property>
<property name="connection.autocommit">true</property>
<!--c39 0911 -->
<!-- -->
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="c3p0.acquire_increment">2</property>
<property name="c3p0.max_size">60</property>
<property name="c3p0.max_statements">100</property>
<property name="c3p0.min_size">1</property>
<property name="c3p0.timeout">120</property>
tomcat运行一段时间,服务器就死,reboot后可以使用。我tomcat日志,localhost日志如下:
信息: SessionListener: contextInitialized()
2012-5-13 8:46:13 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet action threw exception
java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was
unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2503)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2953)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2942)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3485)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2105)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2264)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:187)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1791)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2217)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2108)
at org.hibernate.loader.Loader.list(Loader.java:2103)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:340)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1122)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at com.hncatv.kongzhi.orm.dao.PowerUserRoleDAO.findByProperty(PowerUserRoleDAO.java:93)
at com.hncatv.kongzhi.orm.dao.PowerUserRoleDAO.fi