The last packet successfully received from the server was x milliseconds ago. The last packet sent successfully to the server was y milliseconds ago.100% of the time this alert refers to a miss configured JDBC Pool. The most recent issue we had with this was related to a miss configuration in Tomcat JDBC Pool. The first parameter below will do nothing if you do not explicitely enable when to actually look at the pool. That is what the second parameter does. In other Pools specifying the query will be enough. Reading the documentation for your Pool should give you the necessary clues to adjust it correctly. This issues should be replicable with a restart on mysql side which will close the pool connections from server side. If the client side (Java App Server) is correctly configured it should picked the fact that the connections were closed. If that is not the case you will end up with several connections in TIME_WAIT state.
validationQuery=SELECT 1 testOnBorrow=true