记录解决 springboot2.0 hikaricp - failed to valid... no operations allowed after connection closed.警告问题

具体警告内容:

2020-01-13 14:26:58.733  WARN 15263 --- [http-nio-8830-exec-10] com.zaxxer.hikari.pool.PoolBase          : MyHikariCP - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@49fe3d0e (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2020-01-13 14:26:58.735  WARN 15263 --- [http-nio-8830-exec-10] com.zaxxer.hikari.pool.PoolBase          : MyHikariCP - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@516aa6c4 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2020-01-13 14:26:58.737  WARN 15263 --- [http-nio-8830-exec-10] com.zaxxer.hikari.pool.PoolBase          : MyHikariCP - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@1dda4f2f (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.

看到的大部分解决方案是修改hikari的 max-lifetime配置(不是改大就是该小),各种方法都试过了,然而都没有解决这个问题。

还有一种比较接近的方案就是:

首先在mysql中执行 

SHOW VARIABLES LIKE "%timeout%";

得到结果:

记录解决 springboot2.0 hikaricp - failed to valid... no operations allowed after connection closed.警告问题_第1张图片

坑就坑在这里了,这里查出来的wait_timeout的值显示的是28800秒,误导我以为数据库配置的wait_timeout就是28800,然而并不是,一次偶然的机会,执行了下 vim /etc/my.cnf ,忽然看到下面的画面:

记录解决 springboot2.0 hikaricp - failed to valid... no operations allowed after connection closed.警告问题_第2张图片

我的天,这个玩意谁改的。。。。。

好了,问题找到了,把这项改成28800(8小时),再重启mysql

service mysqld restart

 问题解决。。。

 

你可能感兴趣的:(sprintboot)