Tomcat 7 连接池错误

编程入门 行业动态 更新时间:2024-10-25 02:21:31
本文介绍了Tomcat 7 连接池错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我们已经将代码移到新服务器上,因为之前我们使用的是 tomcat6,但在新系统上安装了 tomcat7.所以我们收到以下错误,我使用谷歌搜索并进行了更改,但仍然遇到相同的错误.错误如下.

we have move the code on new server, as previously we are using the tomcat6 but on new system installed the tomcat7. so we are getting the below error, i did the googling and make the changes but still getting same error. the error as below.

Sep 21, 2014 6:15:14 PM org.apache.tomcat.jdbc.pool.ConnectionPool abandon
WARNING: Connection has been abandoned PooledConnection[com.mysql.jdbc.JDBC4Connection@2365914f]:java.lang.Exception
        at org.apache.tomcat.jdbc.pool.ConnectionPool.getThreadDump(ConnectionPool.java:1063)
        at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:780)
        at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:619)
        at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:188)
        at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:128)
        at com.fstl.resellermg.util.DbUtils.getConnection(DbUtils.java:34)
        at com.fstl.resellermg.bo.LeadExtBO.getListUploadStatus(LeadExtBO.java:1350)
        at com.fstl.resellermg.servlet.GetLeadCountByUserName.doPost(GetLeadCountByUserName.java:56)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:193)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
        at org.apache.tomcat.util.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

我的context.xml 配置是

My context.xml configuration is

<Context>
<Resource name="jdbc/testDB"
auth="Container"
type="javax.sql.DataSource"
username="root"
password=""
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/xxx"
validationQuery="SELECT 1"
validationInterval="30000"
maxWait="1000"
removeAbandoned="true"
initialSize="10"
maxActive="100"
maxIdle="50"
minIdle="10"
suspectTimeout="60"
timeBetweenEvictionRunsMillis="30000"
minEvictableIdleTimeMillis="60000"
testOnBorrow="true"
removeAbandonedTimeout="60"
logAbandoned="true"/>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

</Context>

推荐答案

该错误明确表示连接已被放弃.这意味着两件事之一.在您的代码中的某个地方,您没有正确关闭连接,或者您有一个长时间运行的查询超过了超时(在您的情况下为一分钟),因此 Tomcat 错误地认为它已被放弃.让您的数据库记录慢速查询,或分析您的应用以确定后者是否是这种情况.

The error clearly says the connection was abandoned. This means one of two things. Either somewhere in your code, you're not closing the connection properly, or you have a long running query that exceeds the timeout (a minute in your case) so Tomcat wrongly believes it's been abandoned. Make your DB log slow queries, or profile your app to figure out if the latter is the case.

这篇关于Tomcat 7 连接池错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 03:52:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1389283.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   连接池   Tomcat

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!