com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 1,083,707 milliseconds ago. The last packet sent successfully to the server was 4 milliseconds ago. at sun.reflect.GeneratedConstructorAccessor66.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3090) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2979) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3520) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990) ,,,,,,,,,,,,,,,,,,,,,,, Caused by: java.net.SocketException: Software caused connection abort: recv failed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114) at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161) at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189) at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2537) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2990) ... 115 more
总是出现这个错误,每过几分钟就出现一次,在页面操作第一次出现这个错误,点击操作第二次就可以。
网上说的:
mysql﹥ show global variables like “wait_timeout”;
+–+–+
| Variable_name | Value |
+–+–+
| wait_timeout | 28800 | //–>默认空闲连接时间8个小时,超时将关闭该连接
+–+–+
但是好像并不是这个问题,也不存在8个小时不操作,8分钟都没有。
解决方案
34
33
是不是连接超时了。
33
看样子是连接池超时的问题,给题主个参考
jdbc4.CommunicationsException: Communications link failure 与Mysql空闲等待时间
jdbc4.CommunicationsException: Communications link failure 与Mysql空闲等待时间