com.alibaba.druid.pool.GetConnectionTimeoutException:loopWaitCount 0, wait millis 60000,active 50

druid异常——

Caused by: com.alibaba.druid.pool.GetConnectionTimeoutException: loopWaitCount 0, wait millis 60000, active 50
     at com.alibaba.druid.pool.DruidDataSource.pollLast(DruidDataSource.java:1375)
     at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1019)
     at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:902)
     at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4534)
     at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:661)
     at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4530)
     at com.alibaba.druid.filter.FilterAdapter.dataSource_getConnection(FilterAdapter.java:2723)
     at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4530)
     at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:884)
     at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:876)
     at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:92)
     at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139)
     at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:380)
     at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:228)
     ... 84 more

这个异常可能是因为druid连接池溢出产生的异常。连接超时,是因为某个连接没有成功,而且没有开启druid的超时回收导致的。

原来的配置文件中druid的配置

#druid datasource
druid.initialSize=20
druid.minIdle=10
druid.maxActive=50
druid.maxWait=60000
druid.timeBetweenEvictionRunsMillis=60000
druid.minEvictableIdleTimeMillis=300000
druid.validationQuery=SELECT 'x'
druid.testWhileIdle=true
druid.testOnBorrow=false
druid.testOnReturn=false
druid.poolPreparedStatements=true
druid.maxPoolPreparedStatementPerConnectionSize=20
druid.filters=wall,stat

添加回收机制之后

#druid datasource
druid.initialSize=20
druid.minIdle=10
druid.maxActive=50
druid.maxWait=60000
druid.timeBetweenEvictionRunsMillis=60000
druid.minEvictableIdleTimeMillis=300000
druid.validationQuery=SELECT 'x'
druid.testWhileIdle=true
druid.testOnBorrow=false
druid.testOnReturn=false
druid.poolPreparedStatements=true
druid.maxPoolPreparedStatementPerConnectionSize=20
druid.filters=wall,stat

#druid recycle
druid.removeAbandoned=true
druid.removeAbandonedTimeout=300
druid.logAbandoned=false

就解决了溢出的问题。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值