Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.GetConnec

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/gongxiao1993/article/details/80680025

Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 3000, active 16, maxActive 16"

这个异常可能是因为druid连接池泄漏产生的异常。连接超时,active和maxActive相等,不能够创建新的连接,如果很长时间还获取不到,很有可能是连接池泄漏造成的,而且没有开启druid的超时回收导致的。

添加回收机制后,

#druid recycle
druid.removeAbandoned=true
druid.removeAbandonedTimeout=300
druid.logAbandoned=true
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
配置removeAbandoned对性能会有一些影响,建议怀疑存在泄漏之后再打开。在上面的配置中,如果连接超过300秒未关闭,就会被强行回收,并且日志记录连接申请时的调用堆栈。

猜你喜欢

转载自blog.csdn.net/gongxiao1993/article/details/80680025