I have been getting these exceptions for a number of weeks with no solution...
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 179,695,604 milliseconds ago.
The last packet sent successfully to the server was 179,695,604 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem
So I have altered my application's Context.xml to have the autoReconnect=true
tag set with my databases for connection pooling in Tomcat 7. I have even set wait_timeout
to infinity in the context file.
What am I missing? Is this a common problem? It seems to have a small amount of information around on the net, but when I follow these guides, the same thing happens the next day after a period of inactivity.
The more I use the server, the less this happens. I think it is expiration of the pool connections but how can I stop them expiring if wait_timeout
is failing? Any ideas on how to diagnose the problem or config files?
<Resource name="jdbc/myResource" auth="Container" type="javax.sql.DataSource" maxActive="30" maxIdle="30" maxWait="-1" removeAbandoned="true" logAbandoned="true" username="username" password="password" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/myResource?autoReconnect=true" />
Hi again! This is what the datasource is configured to – Ryley