Tuesday, June 12, 2012

JBoss 7 and Quartz

Had to get an application which uses Quartz running under JBoss for XA Transactions.  Anything that updates a table and then schedules a job has to use XA Transactions or you will run into data consistency problems when things go bad.  I have had a hell of a time.

When i ran my code under JBoss, it would create jobs in Quartz but they would not be persisted to the database.  This same code, ran just fine under Tomcat, although it had the data integrity hole of not using XA Transactions.

What i found is, to make things work in JBoss, you have to set a flag in your Quartz properties file:

org.quartz.jobStore.dontSetAutoCommitFalse = true

After setting this, my jobs actually persisted!  Hope this helps someone.

2 comments:

Sergiu said...

How did you set-up your datasources in JBoss ?

I'm using JobStoreCMT but can't get the scheduler started. The reference on the quartz forums is here:http://forums.terracotta.org/forums/posts/list/7101.page

I'd appreciated some hints :)

Thanks !

N said...

Did you configure the scheduler to start in web.xml? Check out the documentation at: http://quartz-scheduler.org/documentation/quartz-2.1.x/cookbook/ServletInitScheduler