当前位置:   article > 正文

The last packet successfully received from the server was 11,226 milliseconds ago.

the last packet successfully received from the server was 11 milliseconds ag

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure  

The last packet successfully received from the server was 11,226 milliseconds ago.  

Caused by: java.net.SocketException: Connection reset by peer: socket write error

 

两种解决异常:“The last packet successfully received from the server was 11,226 milliseconds ago.   ”的办法 

          出现异常”The last packet successfully received from the server was 11,226 milliseconds ago.  “的大部分原因是由于数据库回收了连接,而系统的缓冲池不知道,继续使用被回收的连接所致的。

           以mysql为例:

           第一种解决办法,就是将mysql回收空闲连接的时间变长,mysql默认回收时间是8小时,可以在mysql目录下的my.ini(my.defaultini)中增加下面配置,将时间改为1天。

           单位是秒,最大好像是24天:

          [mysqld]

          wait_timeout=86400

         interactive_timeout=86400

           第二种解决办法,可以通过配置,让缓冲池去测试连接是否被回收,如果被回收,则不继续使用.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/159638
推荐阅读
相关标签
  

闽ICP备14008679号