Question

I am using Hibernate 3.6.10, MySQL database in my Play(Play 1.2.5) application. I am getting this error everyday

01:05:02,304 ERROR ~ The last packet successfully received from the server was 39,593,644 milliseconds ago.  
The last packet sent successfully to the server was 39,593,644 milliseconds ago. is longer than the server configured value of 'wait_timeout'. 
You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

After restarting the server, the application runs propertly. But after few hours I am getting the same error. Currently I am not using connection pool in my application.

Was it helpful?

Solution

The above issue is solved when I add the following connection details to the hibernate-cfg.xml file

<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">300</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>

Add hibernate-c3p0.jar to the build path.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top