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

DBCP object created 2010-07-02 18:14:42 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.<init>(AbandonedTrace.java:82)
        at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.<init>(DelegatingResultSet.java:72)
        at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.wrapResultSet(DelegatingResultSet.java:81)
        at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
        at org.apache.jsp.news_jsp._jspService(news_jsp.java:99)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)


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

相关推荐