Tomcat报错:DBCP object created 2012-03-03 09:09:34 by the following code was never close

DBCP object created 2010-12-11 11:08:00 by the following code was never closed:
java.lang.Exception
 at org.apache.tomcat.dbcp.dbcp.AbandonedTrace.setStackTrace(AbandonedTrace.java:160)
 at org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:86)
 at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
 at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
 
DBCP object created 2010-12-11 11:08:00 by the following code was never closed:
java.lang.Exception
 at org.apache.tomcat.dbcp.dbcp.AbandonedTrace.init(AbandonedTrace.java:99)
 at org.apache.tomcat.dbcp.dbcp.AbandonedTrace.(AbandonedTrace.java:82)
 at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.(DelegatingStatement.java:61)
 at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.(DelegatingPreparedStatement.java:66)
 at org.apache.tomcat.dbcp.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:262)
这是removeAbandoned=true导致的,使用这个配置的时候将会使用AbandonedObjectPool. 
而AbandonedObjectPool只在开发阶段使用,因为AbandonedObjectPool能帮你发现占用连接过长的代码
log信息说明了getCustomerOnline占用连接超过removeAbandonedTimeout设定的时间.所以设置removeAbandoned=false就行了。

转载于:https://www.cnblogs.com/jenliy/archive/2012/03/03/2378319.html

你可能感兴趣的:(java)