We were having issues with tomcat disconnecting from MySQL after a period of inactivity. Traced it to our MySQL instance having a interactive_timeout set to 8 hours (28800 second). Instead of changing MySQL’s timeout I set tomcat to send a validation query every 28760 seconds.
The following is what I added to conf/contect.xml
timeBetweenEvictionRunsMillis="28700"
minEvictionIdleTimeMillis="28750"
validationQuery="SELECT 1"
validationInterval="28760"
testOnBorrow="true"
removeAbandoned="true"
removeAbandonedTimeout="55"