温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Druid Exception: Connection.clearWarnings

发布时间:2020-07-21 06:47:25 来源:网络 阅读:1053 作者:liuhanling 栏目:软件技术

报错信息:

ERROR c.alibaba.druid.pool.DruidDataSource - recyle error
java.sql.SQLException: Connection.clearWarnings cannot be called on a closed connection
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getSqlException(ExceptionMapper.java:271)
at org.mariadb.jdbc.MariaDbConnection.clearWarnings(MariaDbConnection.java:1070)
at com.alibaba.druid.filter.FilterChainImpl.connection_clearWarnings(FilterChainImpl.java:165)
at com.alibaba.druid.filter.FilterAdapter.connection_clearWarnings(FilterAdapter.java:771)
at com.alibaba.druid.filter.FilterChainImpl.connection_clearWarnings(FilterChainImpl.java:161)
at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.clearWarnings(ConnectionProxyImpl.java:108)
at com.alibaba.druid.pool.DruidConnectionHolder.reset(DruidConnectionHolder.java:295)
at com.alibaba.druid.pool.DruidDataSource.recycle(DruidDataSource.java:1662)

问题:

spring.datasource.druid.initial-size=1
spring.datasource.druid.min-idle=1
spring.datasource.druid.max-active=20
spring.datasource.druid.test-on-borrow=true
spring.datasource.druid.stat-view-servlet.allow=true
spring.datasource.druid.max-wait=60000

解决方案:

spring.datasource.druid.initial-size=1
spring.datasource.druid.min-idle=1
spring.datasource.druid.max-active=20
spring.datasource.druid.test-on-borrow=false
spring.datasource.druid.test-while-idle=true
spring.datasource.druid.validation-query=select 'X'

因为少配置了这个所以拿到了连接不检查,哭晕.........
怪自己太年轻......

spring.datasource.druid.validation-query=select 'X'
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI