关闭

Tomcat连接池报错:DBCP object created by the following code was never closed

151人阅读 评论(0) 收藏 举报

tomcat连接池报错:DBCP object created by the following code was never closed:

DBCP object created 2012-05-16 13:31:27 by the following code was never closed:
java.lang.Exception
    at org.apache.commons.dbcp.AbandonedTrace.setStackTrace(AbandonedTrace.java:160)
    at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:86)
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
    at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
    at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)

经查,这是removeAbandoned=true导致的,使用这个配置的时候将会使用AbandonedObjectPool.
而AbandonedObjectPool建议只在开发阶段使用,因为AbandonedObjectPool能帮你发现占用连接过长的代码.比如这个log信息,说明了getCustomerOnline占用连接超过
                  removeAbandonedTimeout设定的时间.所以设置removeAbandoned=false就行了。AbandonedObjectPool只在开发使用,在后续版本会去掉,现在api都deprecated了.这个功能太容易被误用了!


 
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:200222次
    • 积分:3339
    • 等级:
    • 排名:第10532名
    • 原创:107篇
    • 转载:191篇
    • 译文:1篇
    • 评论:9条
    最新评论