druid 程序运行几天后拿不到数据库连接

dwthyt8l  于 2021-11-27  发布在  Java
关注(0)|答案(2)|浏览(619)

程序运行几天后就会拿不到数据库连接。当我换成别的数据源没这个问题,请问这个是需要配置那些配置。

dump信息如下

**"http-nio-8080-exec-154" daemon prio=10 tid=0x0000000000e32000 nid=0xdc3 waiting on condition [0x00008a2f641e3000]

java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)

  • parking to wait for <0x00000007a143f230> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
    at com.alibaba.druid.pool.DruidDataSource.takeLast(DruidDataSource.java:1732)
    at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1330)
    at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1198)
    at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4619)**

当增加参数: maxWati = 10000 时出现如下异常信息

failed to obtain JDBC connection; nested exception is com.alibaba.druid.pool.getConnectionTimeoutException: wait millis 10000,active 300,maxActive 300 ,creating 0

oymdgrw7

oymdgrw71#

升级 mysql-connector-java 到5.1.48,升级druid到 1.1.24版本可以解决这个问题。

oxosxuxt

oxosxuxt2#

请问为什么要升级5.1.48的?低版本哪里报错了,现在想找下低版本导致问题的原因

相关问题