How to Solve Error: Failed to validate connection

Question:

019-12-03 17:40:42.314   WARN 15940 — [nio-9008-exec-5] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 – Failed to validate connection com.mysql.jdbc. JDBC4Connection@5eb7b0fb (No operations allowed after connection closed.)
java.lang.reflect.UndeclaredThrowableException

If there is no database operation after 15 minutes silence, the above error will be reported

Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl

Analysis is the problem of connection management in Hikari connection pool

 

Solution

Add the following solution.

    hikari:
      minimum-idle: 3
      maximum-pool-size: 10
      max-lifetime: 30000   #Cannot be less than 30 seconds, otherwise default back to 1800 seconds
      connection-test-query: SELECT 1

The last bug was updated. Sometimes the database connection configuration was correct, but it was found that the database could not be connected. The console connected to the default database. Later, it was found that the application.yml package was not generated under my target. Let’s record here. If the small partner has this problem, go to the Maven warehouse to clean it first, and then install it. The problem is solved.

Similar Posts: