Getting rid of SocketException: Broken pipe with Quartz and MySQL on JBoss

If you’re using Quartz on JBoss and configured the full Quartz package (with database scheduled jobs) instead of the lightweight in memory Quartz bundled with the vanilla installation of JBoss, you’ll certainly encounter the problem of


ava.net.SocketException
MESSAGE: Broken pipe

STACKTRACE:

java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2635)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1554)

in your log files after eight hours of inactivity.

If you start googling, you’ll find hundreds of suggestions, such as appending autoreconnect=true to the datasource URL in your quartz-ds.xml, whihc as such is important, but unfortunately wont solve the problem. The solution is described in this excellent post: http://amitcodes.wordpress.com/2008/07/26/16/. Applied to our configuration, you’ll need to add the following lines to your quart-service.xml:

org.quartz.dataSource.QUARTZ_NO_TX.validateOnCheckout = true
org.quartz.dataSource.QUARTZ_NO_TX.validationQuery = select 1

If you’re looking on guidance to install Quartz with database support on JBoss, check this post: http://zunkthoughts.blogspot.com/2008/12/quick-howto-quartz-with-jboss.html

This entry was posted in Distributed Computing, Enterprise Java. Bookmark the permalink.

Leave a comment