There is an error, the server is working normally, but lately this error very often skips over, did not find any sources.

Tomcat 7 and MySQL 5.5 on the same machine, so the application doesn’t have a problem with the network, which very actively writes and reads from the database, the next question is, can this error be due to the fact that the database ends with Connections or what can it be?

SEVERE: Servlet.service () for servlet [appServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent back to the server was 0 milliseconds ago. Root with java.net.ConnectException: Connection refused: connect

Thank you for your attention, thank you for any help.

    1 answer 1

    Before using in your application, you should consider expiring and / or validating the connection by increasing the server-configured values ​​for client timeouts or using the Connector / J autoReconnect = true connection property to avoid this problem.

    • Thanks, now I will try - Denis Happy
    • Thank you, it worked - Denis Happy