mysql的异常:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

来源:互联网 发布:淘宝都要交保证金吗 编辑:程序博客网 时间:2024/06/05 18:42
org.fkjava.ec.exception.EcException: org.apache.ibatis.exceptions.PersistenceException: 

### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure


Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3039)
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:624)
... 60 more


由于MySQL服务在长时间不连接之后断开了,断开之后的首次请求会抛出这个异常。

解决方案:

win7系统

开始 --》管理工具--》组件服务---》服务(本地)--》选中MySql  --》重启动此服务

原创粉丝点击