1
我們使用Tomcat 6.0.26與MySQL 5.1,如下面給出的,以數據庫的連接是建立在server.xml中,Tomcat的不關閉連接,仍然在睡眠模式下
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
<Resource name="jdbc/abs" type="javax.sql.DataSource" maxActive="150" maxIdle="5" username="XXXXXXXXXXX" testWhileIdle="true" removeAbandonedTimeout="60" maxWait="-1" removeAbandoned="true"
validationQuery="select 1" driverClassName="com.mysql.jdbc.Driver" password="XXXXXXXXXXX" minEvictableIdleTimeMillis="30000" timeBetweenEvictionRunsMillis="300000" url="jdbc:mysql://XXXXXXXXXXXX?autoReconnect=true&useUnicode=true&characterEncoding=utf-8"/>
<Resource driverClassName="com.mysql.jdbc.Driver" maxActive="150" maxIdle="5" maxWait="-1" testWhileIdle="true" minEvictableIdleTimeMillis="30000" removeAbandonedTimeout="60" timeBetweenEvictionRunsMillis="300000" name="jdbc/1234" password="XXXXXXXXXXX" removeAbandoned="true" type="javax.sql.DataSource" url="jdbc:mysql:///XXXXXXXXXXXXXXXXXXXXXX?autoReconnect=true&useUnicode=true&characterEncoding=utf-8" username="XXXXXXXXXXX" validationQuery="select 1"/>
當我在MySql中運行show full processlist,它顯示很多連接仍處於睡眠模式,可能會導致這種情況?
問候,
羅希特
我面臨同樣的問題。你能解決這個問題嗎? – 2017-07-23 14:49:30