文档章节

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

施长成
 施长成
发布于 2015/04/30 10:44
字数 597
阅读 29
收藏 0
点赞 0
评论 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
博文 63
码字总数 22544
作品 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

Spring之jdbc Template实现CRUD操作

Spring为各种持久化技术都提供了简单操作的模板回调。比如jdbc、hibernate、Mybatis以及JPA等。 这里我们就以JDBC为例,看看JDBC template怎么实现CRUD操作。 JdbcTemplate主要提供以下几类方...

Java攻城玩家 ⋅ 05/31 ⋅ 0

Linux下部署项目到TomCat,C3p0连接MySQL数据库出错

在本地运行测试正常,部署到Linux-CentOS上后,其他都正常,就是连不上数据库 [root@Linux1 logs]# tail -f catalina.out 五月 23, 2018 2:26:07 上午 org.apache.catalina.startup.HostConf...

LousenJay ⋅ 05/22 ⋅ 0

Springboot 2.0选择HikariCP作为默认数据库连接池的五大理由

转载自公众号:工匠小猪猪的技术世界 摘要: 本文非原创,是笔者搜集了一些HikariCP相关的资料整理给大家的介绍,主要讲解了为什么sb2选择了HikariCP以及HikariCP为什么这么快。 Springboot2默...

渣渣(Charles) ⋅ 05/04 ⋅ 0

Jfinal使用Druid连接池连接informix数据库时出现奇怪语法报错

完全相同的项目,相同的config,相同的sql代码,在用oracle数据库不会报错,用c3p0也不会报错,只有同时使用druid和informix时才报这个异常 只要涉及到informix数据库访问就报这个异常[ERRO...

风逸灬杰 ⋅ 05/28 ⋅ 0

MyBatis系列目录--7. Mybatis与Spring最佳整合

转载请注明出处哈:http://carlosfu.iteye.com/blog/2238662 1. 整合思路 (1) SqlSessionFactory由Spring作为单例管理 (2) spring和mybatis整合生成代理对象,使用SqlSessionFactory创建SqlSe...

付磊-起扬 ⋅ 2015/09/03 ⋅ 0

简单的 ORM 框架 - leopard-jdbc

leopard 是一个简单的 orm 框架,基于注解扫描,实现了自动建表,增删改查,多表外键连接,分页查询,还有简单的逆向工程。 一. leopard 快速上手: 引入核心 jar 包 leopard-orm.jar 引入所...

akcgf ⋅ 04/26 ⋅ 0

主流Java数据库连接池比较及前瞻

本文转载自微信公众号「工匠小猪猪的技术世界」 主流数据库连接池 常用的主流开源数据库连接池有C3P0、DBCP、Tomcat Jdbc Pool、BoneCP、Druid等 C3p0: 开源的JDBC连接池,实现了数据源和JND...

渣渣(Charles) ⋅ 04/30 ⋅ 0

每个项目中,你必须知道的11个Java第三方类库。

Java第三方library ecosystem是一个很广阔的范畴。不久前有人撰文:每个项目中,你必须知道的11个Java第三方类库。 单元测试 1.DBUnit DBunit是一个基于junit扩展的数据库测试框架。它提供了...

thinkyoung ⋅ 2015/01/07 ⋅ 0

Leytton/ThinkJD

中文文档 English Document 最新版本 V1.2.3 1 简介 ,又名,一个简洁而强大的开源JDBC操作库。你可以使用Java像框架的M方法一样,。 先睹为快: //数据库配置(只需调用一次)D.setDbConfig(...

Leytton ⋅ 04/21 ⋅ 0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

BS与CS的联系与区别【简】

C/S是Client/Server的缩写。服务器通常采用高性能的PC、工作站或小型机,并采用大型数据库系统,如Oracle、Sybase、InFORMix或 SQL Server。客户端需要安装专用的客户端软件。 B/S是Brower/...

anlve ⋅ 51分钟前 ⋅ 0

发生了什么?Linus 又发怒了?

在一个 Linux 内核 4.18-rc1 的 Pull Request 中,开发者 Andy Shevchenko 表示其在对设备属性框架进行更新时,移除了 union 别名,这引发了 Linus 的暴怒。 这一次 Linus Torvalds 发怒的原...

问题终结者 ⋅ 今天 ⋅ 0

在树莓派上搭建一个maven仓库

在树莓派上搭建一个maven仓库 20180618 lambo init 项目说明 家里有台树莓派性能太慢。想搭建一个maven私服, 使用nexus或者 jfrog-artifactory 运行的够呛。怎么办呢,手写一个吧.所在这个...

林小宝 ⋅ 今天 ⋅ 0

Spring发展历程总结

转自与 https://www.cnblogs.com/RunForLove/p/4641672.html 目前很多公司的架构,从Struts2迁移到了SpringMVC。你有想过为什么不使用Servlet+JSP来构建Java web项目,而是采用SpringMVC呢?...

onedotdot ⋅ 今天 ⋅ 0

Python模块/包/库安装(6种方法)

Python模块/包/库安装(6种方法) 冰颖机器人 2016-11-29 21:33:26 一、方法1: 单文件模块 直接把文件拷贝到 $python_dir/Lib 二、方法2: 多文件模块,带setup.py 下载模块包(压缩文件zip...

cswangyx ⋅ 今天 ⋅ 0

零基础学习大数据人工智能,学习路线篇!系统规划大数据之路?

大数据处理技术怎么学习呢?首先我们要学习Python语言和Linux操作系统,这两个是学习大数据的基础,学习的顺序不分前后。 Python:Python 的排名从去年开始就借助人工智能持续上升,现在它已经...

董黎明 ⋅ 今天 ⋅ 0

openJdk和sun jdk的区别

使用过LINUX的人都应该知道,在大多数LINUX发行版本里,内置或者通过软件源安装JDK的话,都是安装的OpenJDK, 那么到底什么是OpenJDK,它与SUN JDK有什么关系和区别呢? 历史上的原因是,Ope...

jason_kiss ⋅ 今天 ⋅ 0

梳理

Redux 是 JavaScript 状态容器,提供可预测化的状态管理。 它是JS的状态容器,是一种解决问题的方式,所以即可以用于 react 也可以用于 vue。 需要理解其思想及实现方式。 应用中所有的 stat...

分秒 ⋅ 今天 ⋅ 0

Java 后台判断是否为ajax请求

/** * 是否是Ajax请求 * @param request * @return */public static boolean isAjax(ServletRequest request){return "XMLHttpRequest".equalsIgnoreCase(((HttpServletReques......

JavaSon712 ⋅ 今天 ⋅ 0

Redis 单线程 为何却需要事务处理并发问题

Redis是单线程处理,也就是命令会顺序执行。那么为什么会存在并发问题呢? 个人理解是,虽然redis是单线程,但是可以同时有多个客户端访问,每个客户端会有 一个线程。客户端访问之间存在竞争...

码代码的小司机 ⋅ 今天 ⋅ 0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部