gpt4 book ai didi

java - Tomcat 7 连接池错误

转载 作者:行者123 更新时间:2023-11-30 06:17:19 24 4
gpt4 key购买 nike

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

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.net.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配置是

<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 错误地认为它已被放弃。让您的数据库记录慢速查询,或分析您的应用以确定是否属于后者。

关于java - Tomcat 7 连接池错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25978398/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com