MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection

时光总嘲笑我的痴心妄想 提交于 2019-11-29 06:07:00
Ravinder Reddy

As per the error stacktrace, your connection to MySQL server is lost.

>root cause 

>com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
  No operations allowed after connection closed.
  Connection was implicitly closed due to underlying exception/error: 

** BEGIN NESTED EXCEPTION ** 
    >com.mysql.jdbc.exceptions.jdbc4.CommunicationsException 
MESSAGE: Communications link failure 

>Last packet sent to the server was 43 ms ago. 

>STACKTRACE: 

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

It is very clear that the root cause is Communications link failure.

Try pinging your database server and see if you are able to connect.
Else resolve the network issue and then connect. No alternatives for this.

You can issue a light weight ping to your database server to check the connection availability.
Please read following discussion and articles:

  1. Ping MySQL Server
  2. Ping syntax and example

Just check once whether you have added @Repository annotation in the Repository class. because this could also be main reason for the exception.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!