Hi all
I seek solutions to a communication problem, most likely a timeout issue. I use GlassFish 3, MySQL Community Server 5.1 and Connector/J 5.1.12 and EclipseLink (JPA 2.0)
I have three stateless EJB3s. Bean A uses bean B for DB access and bean C for analysis. Running my app I call one of A's public methods. This one then performs a few initial DB queries using B, followed by a lengthy analysis using C and finally stores the result from the analysis in the DB using B.
The time span of the analysis may be from a few minutes to 10h or more, depending on the size of the datasets. In my development I focused on small datasets and the app runs nicely. Now, stress testing the app with larger datasets, i.e. analysis time of the order of 10h, a CommunicationsException is thrown following the analysis. The GlassFish server log reads as follows:
---
Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 38,687,892 milliseconds ago. The last packet sent successfully to the server was 38,687,893 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.
Error Code: 0
---
I use the default wait_timeout of 8h in the MySQL server. Also, browsing blogs and forums I find that tuning the autoReconnect property of Connector/J is not recommended.
Is there a way to handle this issue without increasing wait_timeout of the MySQL server? I.e. can one configure the connection pool in GlassFish to properly validate the connection? In that case please provide the magic attribute or property values.
[Message sent by forum member 'jeeans']
http://forums.java.net/jive/thread.jspa?messageID=398900