mysql报错 is longer than the server configured value of 'wait_timeout'...

具体报错信息:Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 
The last packet successfully received from the server was 52,075,567 milliseconds ago.
  The last packet sent successfully to the server was 52,075,568 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.

原因分析:

MySQL连接时,服务器默认的“wait_timeout”是8小时,也就是说一个connection空闲超过8个小时,Mysql将自动断开该connection。connections如果空闲超过8小时,Mysql将其断开,而DBCP连接池并不知道该connection已经失效,如果这时有Client请求connection,DBCP将该失效的Connection提供给Client,将会造成异常。

1,首先进入

你可能感兴趣的:(mysql)