当前位置:   article > 正文

《框架升级问题记录-spring3至Spring5.3.19-DruidDataSource报错》_keepalivebetweentimemillis must be grater than tim

keepalivebetweentimemillis must be grater than timebetweenevictionrunsmillis

DruidDataSource报错

1、报错现象:

nested exception is java.sql.SQLException: keepAliveBetweenTimeMillis must be grater than timeBetweenEvictionRunsMillis

2、报错原因

新版本不兼容。
DruidDataSource中有下面这样的一个判断,要求keepAliveBetweenTimeMillis"保活检查间隔时间"要大:

 if (this.keepAlive && this.keepAliveBetweenTimeMillis <= this.timeBetweenEvictionRunsMillis) {
                            throw new SQLException("keepAliveBetweenTimeMillis must be grater than timeBetweenEvictionRunsMillis");
                        }
  • 1
  • 2
  • 3

1)keepAliveBetweenTimeMillis目前没有配置 //默认值= 120000L是120s,保活检查间隔时间 这个druid 1.1.1没有,druid1.2.8有且要求大于timeBetweenEvictionRunsMillis;
2).timeBetweenEvictionRunsMillis目前配置600000=600秒=10分 //默认值= 60000L是60s,检查空闲连接的频率

3、解决

配置修改:

所有的timeBetweenEvictionRunsMillis修改为110,即:
timeBetweenEvictionRunsMillis=110000
  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/336973
推荐阅读
相关标签
  

闽ICP备14008679号