问题描述
Springboot项目长时间没运行我运行的时候一直报错,导致接口调用失败
2021-02-23 18:13:23.044 WARN 13564 --- [nio-8088-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@6f72819 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2021-02-23 18:13:28.050 WARN 13564 --- [nio-8088-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@77ead82b (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2021-02-23 18:13:33.071 WARN 13564 --- [nio-8088-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@2254d332 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2021-02-23 18:13:38.084 WARN 13564 --- [nio-8088-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@1b8bc28a (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2021-02-23 18:13:43.104 WARN 13564 --- [nio-8088-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@665c333f (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2021-02-23 18:13:48.118 WARN 13564 --- [nio-8088-exec-7] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@12452c08 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2021-02-23 18:13:48.140 ERROR 13564 --- [nio-8088-exec-7] c.e.a.p.e.CustomExceptionHandler : [ 系统异常 ]{}
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30100ms.
一、解决方法
配置文件中加入
minimum-idle最小空闲数
maximum-pool-size链接池最大数量
max-lifetime最大时长,配置为0则是永久不过期
spring.datasource.hikari.minimum-idle=3
spring.datasource.hikari.maximum-pool-size=5
spring.datasource.hikari.max-lifetime=0
总结
- 愿所有的有情人,皆成眷属。
- 愿家人平安喜乐!愿我心想如意!
- 声问候,带给你一个新的愿望。
- 愿你在夏日的每天,都幸福快乐!
- 愿这盏平安灯,保佑你平安健康!
- 新的一年,愿你不只是又老—岁!
- 愿家人身体健健康康,平平安安。
- 愿你幸福永健康,好运财运长伴你!
- 愿你家庭美满,身体健康,事业顺利!
- 许一个美丽的心愿祝福你,微笑甜甜!