I have responsibility for a legacy Tomcat webapp running as webapps/ROOT. Previously the app was running on a dedicated Linux server, but to save money I was asked to move it to a different Linux server where it shares a MySQL database with a few PHP apps. They are all fed through Apache 2 using VirtualHosts.
Since moving over, the Tomcat app seems to ocassionally "consume" all database connections to the point where the Tomcat app won't respond to requests, but the PHP apps on the server will also not respond to requests. A restart of Tomcat resolves the problem.
Currently, my hack is to set up a cron job to bounce Tomcat every evening. This is reduced the number of these incidents, but they still occur occasionally.
In this app, the database connection is defined in server.xml. I've tried modifying maxActive. Originally, it was set to 99, but I changed to -1 but it didn't seem to help one way or the other.
<Resource name="jdbc/theApp" auth="Container"
type="javax.sql.DataSource"
username="tomcat"
password="thePassword"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/theApp?autoReconnect=true"
maxActive="-1"
maxIdle="20"
maxWait="3000"
removeAbandoned="true"
removeAbandonedTimeout="300"
logAbandoned="true"/>
Question: Has anyone seen this? If not, is there a way to help diagnose what is going wrong? The original development team is not available.