Spring Boot 數據庫無法驗證連接


Spring Boot 2 項目,使用 Spring Data JPA 管理數據庫,默認使用 HikariCP 連接池經常出現警告:

 
         

2019-05-25 14:13:55.231 WARN 26204 --- [0.0-2000-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@1a1e5614 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2019-05-25 14:14:00.232 WARN 26204 --- [0.0-2000-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@7f91fcb5 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2019-05-25 14:14:05.234 WARN 26204 --- [0.0-2000-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@1757aba5 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2019-05-25 14:14:10.236 WARN 26204 --- [0.0-2000-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@2cffa1a9 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2019-05-25 14:14:15.237 WARN 26204 --- [0.0-2000-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@642d86bc (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2019-05-25 14:14:20.240 WARN 26204 --- [0.0-2000-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@1f2e018e (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.

2019-05-25 14:14:20.243 WARN 26204 --- [0.0-2000-exec-7] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 08003
2019-05-25 14:14:20.243 ERROR 26204 --- [0.0-2000-exec-7] o.h.engine.jdbc.spi.SqlExceptionHelper : HikariPool-1 - Connection is not available, request timed out after 30021ms.
2019-05-25 14:14:20.243 ERROR 26204 --- [0.0-2000-exec-7] o.h.engine.jdbc.spi.SqlExceptionHelper : No operations allowed after connection closed.

雖然程序從 HikariCP 連接池獲取到了連接,但是連接不可用。可以嘗試設置 maxLifetime 時間


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM