java - MySQL Database connection disconnected after few minute -


i working on spring+hibernate+jsf if ideal on page few minute getting exception when trying database query

 last packet received server 2,615,049 milliseconds ago.  last packet sent server 27 milliseconds ago.  caused by: org.hibernate.transactionexception: jdbc begin transaction failed:      @ org.hibernate.engine.transaction.internal.jdbc.jdbctransaction.dobegin(jdbctransaction.java:76)     @ org.hibernate.engine.transaction.spi.abstracttransactionimpl.begin(abstracttransactionimpl.java:160)     @ org.hibernate.internal.sessionimpl.begintransaction(sessionimpl.java:1309)     @ org.springframework.orm.hibernate4.hibernatetransactionmanager.dobegin(hibernatetransactionmanager.java:474)     ... 46 more caused by: com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link failure 

is issue due configuration in project or database vendor issue in web.xml made entry

<session-config>    <session-timeout>           30    </session-timeout>  </session-config> 

connection pool

<bean id="datasource" class="com.mchange.v2.c3p0.combopooleddatasource" destroy-method="close">         <property name="driverclass" value="com.mysql.jdbc.driver" />         <property name="jdbcurl" value="jdbc:mysql://ip:3306/ccc" />                 <property name="user" value=" hariom" />                 <property name="password" value="password" />         <property name="maxpoolsize" value="2" />         <property name="maxstatements" value="0" />         <property name="minpoolsize" value="1" /> </bean> 

you should add property ;

<property name="validationquery" value="select 1" /> 

this validate connection ,and if mysql closed connection app won't try send packet.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -