ERRO DE CONEXÃO COM JPA MYSQL

Java

02/05/2016

Boa tarde Diego!

Tenho um sistema que já está em produção, onde utilizo as tecnologias, JSF Primefaces, Hibernate 5.0 com JPA e como o banco de dados utilizo o MySql 6.3 CE. Ocorre que quando em produção ocorreu o seguinte erro no mysql
 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was36940 seconds ago.The last packet sent successfully to the server was 36940 seconds ago, which 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. 


Depois de dado este problema, tenho que reiniciar o Tomcat para o sistema funcionar. Como resolver esse problema.
Girleno Silva

Girleno Silva

Curtidas 0

Respostas

Marcos Paulo

Marcos Paulo

02/05/2016

Reiniciar sempre o tomcat? com que frequencia?
GOSTEI 0
Girleno Silva

Girleno Silva

02/05/2016

É um erro de timeout no MySQL. Conforme erro abaixo. Não quero ter que reiniciar toda vez o tomcat quando esse erro ocorrer.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was36940 seconds ago.The last packet sent successfully to the server was 36940 seconds ago, which 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.


Este erro ocorre com o MySQL depois de mais ou menos oito horas de funcionamento da aplicação e a mesma é travada. Como corrigir esse problema?
GOSTEI 0
Marcos Paulo

Marcos Paulo

02/05/2016

O arquivo de conexão, está ok?
GOSTEI 0
POSTAR