java.io.EOFException: Can not read response from server. Expected to read 67 bytes, read 20 bytes before connection was unexpectedly lost.
在我的CentOs出现的问题。原因是Tomcat使用了数据库连接池,但MYSQL中没有配置wait_timeout,默认是8小时。
wait_timeout后,数据库连接池中的连接被MYSQL释放了,但并没有通知TOMCAT。所以TOMCAT中保存了无效的数据库连接。
主要涉及几个参数的设置:
testOnBorrow
testWhileIdle
validationQuery
timeBetweenEvictionRunsMillis minEvictableIdleTimeMillis
参考下面的文章:
http://campa.wordpress.com/2007/01/29/tomcat-55-jndi-datasource-definition-for-mysql/
http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Introduction