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 时间

  • 相关阅读:
    k8s资源编排
    虫师『软件测试』基础 与 测试杂谈
    虫师『性能测试』文章大汇总
    OMCS ——卓尔不群的网络语音视频聊天框架(跨平台)
    ESFramework ——成熟的C#网络通信框架(跨平台)
    2022.2 区块链的技术架构
    pytest文档80 内置 fixtures 之 cache 写入中文显示\u4e2d\u6587问题(用打补丁方式解决) 上海
    翻译校正
    Inside WCF Runtime
    Web Services Security
  • 原文地址:https://www.cnblogs.com/1x11/p/10922761.html
Copyright © 2011-2022 走看看