首页 > 其它 > 题目详情
JDBC连接池的问题.请问在什么情况下,找了好久,找不到原因.org.apache.tomcat.jdbc.pool.C
题目内容:
JDBC连接池的问题.请问在什么情况下,找了好久,找不到原因.
org.apache.tomcat.jdbc.pool.ConnectionPool abandon
警告:Connection has been abandoned PooledConnection[com.mysql.jdbc.JDBC4Connection@5ebeda8]:java.lang.Exception
at org.apache.tomcat.jdbc.pool.ConnectionPool.getThreadDump(ConnectionPool.java:1023)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:752)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:600)
at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:179)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:126)
at com.smartererp.common.db.BaseDao.getConn(BaseDao.java:71)
at com.smartererp.cos.biz.order.OrderDAO.generateMakeorderSyncInfo(OrderDAO.java:823)
at com.smartererp.cos.biz.order.OrderManager.makeOrder(OrderManager.java:54)
at com.smartererp.cos.ui.order.OrderFacade.makeOrder(OrderFacade.java:40)
at pc.PC001Action._btnMusterPass(PC001Action.java:78)
at pc.PC001Action.execute(PC001Action.java:25)
at com.needtool.jdf.TemplateAction.doprocess(TemplateAction.java:64)
at com.needtool.jdf.DispatchServlet.processRequest(DispatchServlet.java:190)
at com.needtool.jdf.DispatchServlet.doPost(DispatchServlet.java:306)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.needtool.jdf.CommonFilter.doFilter(CommonFilter.java:21)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)优质解答
推荐在使用连接池的情况下connection对象每次用完后都关闭.
这种情况我看应该修改一下jdbc连接池的配置.添加如下配置:
removeAbandoned:true
removeAbandonedTimeout:120
testOnBorrow:true
logAbandoned:true
org.apache.tomcat.jdbc.pool.ConnectionPool abandon
警告:Connection has been abandoned PooledConnection[com.mysql.jdbc.JDBC4Connection@5ebeda8]:java.lang.Exception
at org.apache.tomcat.jdbc.pool.ConnectionPool.getThreadDump(ConnectionPool.java:1023)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:752)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:600)
at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:179)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:126)
at com.smartererp.common.db.BaseDao.getConn(BaseDao.java:71)
at com.smartererp.cos.biz.order.OrderDAO.generateMakeorderSyncInfo(OrderDAO.java:823)
at com.smartererp.cos.biz.order.OrderManager.makeOrder(OrderManager.java:54)
at com.smartererp.cos.ui.order.OrderFacade.makeOrder(OrderFacade.java:40)
at pc.PC001Action._btnMusterPass(PC001Action.java:78)
at pc.PC001Action.execute(PC001Action.java:25)
at com.needtool.jdf.TemplateAction.doprocess(TemplateAction.java:64)
at com.needtool.jdf.DispatchServlet.processRequest(DispatchServlet.java:190)
at com.needtool.jdf.DispatchServlet.doPost(DispatchServlet.java:306)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.needtool.jdf.CommonFilter.doFilter(CommonFilter.java:21)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
优质解答
这种情况我看应该修改一下jdbc连接池的配置.添加如下配置:
removeAbandoned:true
removeAbandonedTimeout:120
testOnBorrow:true
logAbandoned:true
本题链接: