Sporadic connection failures between JBoss datasources and MySQL
Issue
- The server.log shows exception trace like :
ERROR [org.hibernate.transaction.JDBCTransaction] (http-0.0.0.0-8180-11) JDBC commit failed
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 39.990.827 milliseconds ago. The last packet sent successfully to the server was 39.990.827 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.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...
...
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
...
...
JBoss can not reconnect to MySQL after that (a restart is mandatory).
Environment
-
JBoss Enterprise Application Platform (EAP)
- 4.3.x
- 5.x
- 6.x
- 7.x
-
MySQL Server
- 5.x and higher
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.