zoukankan      html  css  js  c++  java
  • 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 时间

  • 相关阅读:
    IT程序猿”是怎样练成的? 之 提升内驱力的7大秘籍转
    wp7 退出程序的提示对话框
    生活不容易
    Decorator模式学习
    用序列化方法实现的Prototype的深拷贝
    Observer pettern
    Adapter模式学习
    bridge模式学习
    Composite模式学习
    Prototype原形设计模式
  • 原文地址:https://www.cnblogs.com/1x11/p/10922761.html
Copyright © 2011-2022 走看看