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