jdk 1.7 ,tomcat 8 环境,mysql5.x
,项目使用框架jfinal,项目运行过程中,发现数据库链接异常,异常代码:
2015-10-30 11:01:35 com.mchange.v2.resourcepool.BasicResourcePool , row at 1841 : com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7db1b37e -- Acquisition Att
empt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attem
pts (30). Last acquisition attempt exception:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
数据库的wait_timeou=10,
而jfinal的C3p0设置为默认设置,请高人帮忙看一下这是什么情况。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
注意看这句异常信息:we failed to succeed more than the maximum number of allowed acquisition attempts (30)
。当请求数据库连接时,超过了所允许的最大连接数,查看一下 c3p0 配置的 maxPoolSize,以及数据库所能允许的最大连接数配置。
如果这两个配置都比较合理,检查一下程序中有无长时间占用连接的代码,或者使用 `DbKit.getConfig().getConnection() 获取的 connection `对象没有在 finally 块中进行 close(),从而造成连接泄漏。