Wednesday, March 27, 2013

Spring 3.2 quartz 2.1 Jobs added with no trigger must be durable.

I am trying to enable HA on nodes and in that process I found that in a two test node setup a job that has a frequency of 10 sec was running into deadlock. So I tried upgrading from Quartz 1.8 to 2.1 by following the migration guide but I ran into an exception that says "Jobs added with no trigger must be durable.".

After looking into spring and Quartz code I figured out that now Quartz is more strict and earlier the scheduler.addJob had a replace parameter which if passed to true would skip the durable check, in latest quartz this is fixed but spring hasnt caught up to this. So what do you do, well I jsut inherited the factory and set durability to true and use that

public class DurableJobDetailFactoryBean extends JobDetailFactoryBean {
    public DurableJobDetailFactoryBean() {

and used this instead of JobDetailFactoryBean in the spring bean definition

    <bean id="restoreJob" class="">


  1. You don't need to do that ... You can set durability with a property:

  2. You only have to set durability property to true while defining your job bean:

    1. I know but what if a programmer forgets to define durability. I wanted to take care of that because I knew all my jobs need to be durable.

  3. I need to modify all my job definitions to be durable just because Spring didn't catch up with Quartz? It's a workaround, but doesn't sound right. The DurableJobDetailFactoryBean approach is also a workaround. I'll discuss in spring forum and probably open a jira request

  4. Spring 4 now has this in JobDetailFactoryBean.