文档章节

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
Hibernate c3p0 数据库连接池

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

boonya
2014/07/14
0
0
MySQL+Hibernate下连接空闲8小时自动断开问题解决

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

heroShane
2014/01/27
0
0

没有更多内容

加载失败,请刷新页面

加载更多

sourcetree 离线免注册登录安装教程

Sourcetree是一个优秀的git可视化管理工具,深受开发者喜爱Sourcetree官网,但是在安装时需要谷歌账户登录,需要翻qiang才可以,此一点一直被人们所诟病。今天本教程就为大家提供离线免登陆安...

QQZZFT
10分钟前
0
0
使用 PostgreSQL 解决一个实际的统计分析问题

使用 PostgreSQL 解决一个实际的统计分析问题作者:老农民(刘启华)Email: 46715422@qq.com 之前有个朋友扔给我一个奇葩需求,他们公司之前做了一批问卷调查,全部都是统一格式的excel...

新疆老农民
13分钟前
0
0
TypeScript基础入门之高级类型的映射类型

转发 TypeScript基础入门之高级类型的映射类型 高级类型 映射类型 一个常见的任务是将一个已知的类型每个属性都变为可选的: interface PersonPartial {    name?: string;    age?...

durban
28分钟前
0
0
Dubbo源码分析(6):Dubbo内核实现之基于SPI思想Dubbo内核实现

SPI接口定义 定义了@SPI注解 package com.alibaba.dubbo.common.extension; import java.lang.annotation.Documented;import java.lang.annotation.ElementType;import java.lang.an......

郑加威
28分钟前
0
0
RxJS的另外四种实现方式(后记)—— 同时实现管道和链式编程

目录 RxJS的另外四种实现方式(序) RxJS的另外四种实现方式(一)——代码最小的库 RxJS的另外四种实现方式(二)——代码最小的库(续) RxJS的另外四种实现方式(三)——性能最高的库 Rx...

一个灰
31分钟前
0
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部