开发者社区> 问答> 正文

jfinal 使用mysql数据库偶然出现超时错误

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设置为默认设置,请高人帮忙看一下这是什么情况。

展开
收起
小旋风柴进 2016-03-11 16:04:55 4249 0
1 条回答
写回答
取消 提交回答
  • 注意看这句异常信息:we failed to succeed more than the maximum number of allowed acquisition attempts (30)。当请求数据库连接时,超过了所允许的最大连接数,查看一下 c3p0 配置的 maxPoolSize,以及数据库所能允许的最大连接数配置。

    如果这两个配置都比较合理,检查一下程序中有无长时间占用连接的代码,或者使用 `DbKit.getConfig().getConnection() 获取的 connection `对象没有在 finally 块中进行 close(),从而造成连接泄漏。
    2019-07-17 18:59:30
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
搭建电商项目架构连接MySQL 立即下载
搭建4层电商项目架构,实战连接MySQL 立即下载
PolarDB MySQL引擎重磅功能及产品能力盛大发布 立即下载

相关镜像