Possibly consider using a shorter maxLifetime value.解决方法

Posted 秋9

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Possibly consider using a shorter maxLifetime value.解决方法相关的知识,希望对你有一定的参考价值。

【现象】

2022-08-24 14:54:49.130  WARN 174160 --- [nio-8082-exec-3] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@7df9ca28 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.

2022-08-24 14:54:54.146  WARN 174160 --- [nio-8082-exec-3] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@7150aa4 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.

2022-08-24 14:54:54.154  WARN 174160 --- [nio-8082-exec-2] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@16c7f560 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.

【解决方法】

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/user?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
    username: root
    password: root

修改为:

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/user?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
    username: root
    password: root
    hikari:
      connection-timeout: 10000
      validation-timeout: 3000
      idle-timeout: 60000
      login-timeout: 5
      max-lifetime: 60000
      maximum-pool-size: 10
      minimum-idle: 5
      read-only: false

以上是关于Possibly consider using a shorter maxLifetime value.解决方法的主要内容,如果未能解决你的问题,请参考以下文章

Possibly consider using a shorter maxLifetime value.解决方法

mysqlHikariCP不断打印WARN日志Failed to validate connection JDBC4Connectio Possibly consider using a shor

Error: Your project contains C++ files but it is not using a supported native build system.Consider(

pip install报错,“Consider using the `--user` option or check the permissions”

error: possibly undefined macro: LT_SYS_SYMBOL_USCORE please use m4_pattern_allow

Python提示:Consider using the `--user` option or check the permissions.