0

我在我的 Play(Play 1.2.5) 应用程序中使用 Hibernate 3.6.10,MySQL 数据库。我每天都收到这个错误

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.

重新启动服务器后,应用程序可以正常运行。但几个小时后,我得到了同样的错误。目前我没有在我的应用程序中使用连接池。

4

1 回答 1

0

当我将以下连接详细信息添加到 hibernate-cfg.xml 文件时,上述问题得到解决

<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>

将 hibernate-c3p0.jar 添加到构建路径。

于 2014-04-17T12:36:59.297 回答