文档章节

c3p0 连接过多导致tomcat无法启动的解决方法

施长成
 施长成
发布于 2015/04/30 10:44
字数 597
阅读 31
收藏 0

错误:

WARN  com.mchange.v2.async.ThreadPoolAsynchronousRunner  com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@27e467f7 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2015-04-30 10:29:43 WARN  com.mchange.v2.async.ThreadPoolAsynchronousRunner  com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@27e467f7 -- APPARENT DEADLOCK!!! Complete Status:
        Managed Threads: 3
        Active Threads: 3
        Active Tasks:
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6bd962a4 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@cdb344d (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@b46b1d3 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
        Pending Tasks:
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4e44996d
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@79b4eb3f
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@54c0b385
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@374a0c3b
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5e6911d8
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4412ac54
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@25efe1b6
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@27cb872f
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@23183312
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@9c0f4be
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5b03eaf2
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5e35e48c
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@242fd3a6
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@3ff049d9
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@3880665a
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@75bfbbb0
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7ebb5c34
Pool thread stack traces:
        Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
                java.net.PlainSocketImpl.socketConnect(Native Method)
                java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
                java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
                java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
                java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
                java.net.Socket.connect(Socket.java:579)
                java.net.Socket.connect(Socket.java:528)
                java.net.Socket.<init>(Socket.java:425)
                java.net.Socket.<init>(Socket.java:241)
                com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
                com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:293)
                com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
                com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
                com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
                sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
                com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
                com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
                com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
                com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
                com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
                com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
                com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
                com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
                com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
        Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
                java.net.PlainSocketImpl.socketConnect(Native Method)
                java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
                java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
                java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
                java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
                java.net.Socket.connect(Socket.java:579)
                java.net.Socket.connect(Socket.java:528)
                java.net.Socket.<init>(Socket.java:425)
                java.net.Socket.<init>(Socket.java:241)
                com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
                com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:293)
                com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
                com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
                com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
                sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
                com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
                com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
                com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
                com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
                com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
                com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
                com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
                com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
                com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
        Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
                java.net.PlainSocketImpl.socketConnect(Native Method)
                java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
                java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
                java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
                java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
                java.net.Socket.connect(Socket.java:579)
                java.net.Socket.connect(Socket.java:528)
                java.net.Socket.<init>(Socket.java:425)
                java.net.Socket.<init>(Socket.java:241)
                com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
                com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:293)
                com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
                com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
                com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
                sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
                com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
                com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
                com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
                com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
                com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
                com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
                com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
                com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
                com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)

解决方法:

    先关闭mysql数据库,然后在打开数据库,只限于测试环境,如果是正式环境请设置连接池的最大数量小于mysql的最大连接数量,而且不用mysql工具连接服务器,或者连接后及时关闭,减少连接数。

© 著作权归作者所有

共有 人打赏支持
施长成
粉丝 5
博文 65
码字总数 23983
作品 0
浦东
后端工程师
私信 提问
c3p0、dbcp、tomcat jdbc pool 连接池区别

查看资料,得知dbcp和c3p0都是单线程的,在高并发的环境下性能会非常低下, 决定换用tomcat自带的jdbc-pool,关于jdbc-pool的项目介绍。 区别参考链接:http://www.open-open.com/lib/view/o...

张嘴吃药
2017/10/30
0
0
tomcat JDBC连接池c3p0连接资源耗尽导致tomcat实例对应的app移动端无法访问。

tomcat app手机端程序无法打开了。 直接查看tomcat日志: [test@web01 logs]$ tail catalina.out at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at......

sandshell
05/04
0
0
数据库连接池DBCP和C3P0的使用

hibernate开发组推荐使用c3p0; spring开发组推荐使用dbcp; hibernate in action推荐使用c3p0; 一. dbcp 在数据库服务器强行关闭连接或数据库服务重启后,无法reconnect 二. dbcp 连接池的创建...

mn_1127
2015/08/27
0
0
MySQL+Hibernate下连接空闲8小时自动断开问题解决

本文为转载学习 转载文章1:http://hi.baidu.com/boyyf/item/fe4dcc1329297349e75e06ce 前段时间刚完成一个家教网项目,数据库为MySQL5.0,持久层使用Hibernate 3.1,没有使用额外的连接池,...

heroShane
2014/01/27
0
0
Hibernate c3p0 数据库连接池

From :http://www.codeweblog.com/hibernate-using-c3p0-connection-pooling/ c3p0是开源JDBC连接池,Hibernate的发布版也有此功能。这篇文章描述怎样使用Hibernate来配置从c3p0。C3p0连接池...

boonya
2014/07/14
0
0

没有更多内容

加载失败,请刷新页面

加载更多

apache顶级项目(二) - B~C

apache顶级项目(二) - B~C https://www.apache.org/ Bahir Apache Bahir provides extensions to multiple distributed analytic platforms, extending their reach with a diversity of s......

晨猫
44分钟前
0
0
day152-2018-11-19-英语流利阅读

“超级食物”竟然是营销噱头? Daniel 2018-11-19 1.今日导读 近几年来,超级食物 superfoods 开始逐渐走红。不难发现,越来越多的轻食餐厅也在不断推出以超级食物为主打食材的健康料理,像是...

飞鱼说编程
今天
2
0
SpringBoot源码:启动过程分析(二)

接着上篇继续分析 SpringBoot 的启动过程。 SpringBoot的版本为:2.1.0 release,最新版本。 一.时序图 一样的,我们先把时序图贴上来,方便理解: 二.源码分析 回顾一下,前面我们分析到了下...

Jacktanger
昨天
3
0
Apache防盗链配置,Directory访问控制,FilesMatch进行访问控制

防盗链配置 通过限制referer来实现防盗链的功能 配置前,使用curl -e 指定referer [root@test-a test-webroot]# curl -e "http://www.test.com/1.html" -x127.0.0.1:80 "www.test.com/1.jpg......

野雪球
昨天
3
0
RxJava threading

因为Rx针对异步系统设计,并且Rx也自然支持多线程,所以新的Rx开发人员有时会假设Rx默认是多线程的。在其他任何事情之前,重要的是澄清Rx默认是单线程的。 除非另有说明,否则每次调用onNex...

woshixin
昨天
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部