Friday, June 15, 2012

Upgrade Quartz 1.8.5 to Quartz 2.1.5 and Spring 3.0.3 to Spring 3.1.1

I had an existing app that used Quartz 1.8.5 and Spring 3.0.3's wrapper classes for configuration.  I needed to update Quartz to 2.x so that I could use multiple schedulers in a clustered environment via JDBCJobStore.  You can't just update Quartz, you also have to update Spring to 3.1.x.  I got hung up on this for a long time.  My application would just crash on startup with the existing configuration.  I finally determined that I was using the wrong wrapper classes.  I'll list the old classes I was using and the ones that I needed to swap out to make it work.

  • org.springframework.scheduling.quartz.SchedulerFactoryBean
    • No change needed
  • org.springframework.scheduling.quartz.CronTriggerBean
    • org.springframework.scheduling.quartz.CronTriggerFactoryBean
  • org.springframework.scheduling.quartz.JobDetailBean
    • org.springframework.scheduling.quartz.JobDetailFactoryBean
  • org.springframework.scheduling.quartz.QuartzJobBean
    • No change needed

So your steps are
  1. Replace with new quartz jar
  2. Replace with new spring jars
  3. Change
    1. CronTriggerBean to  CronTriggerFactoryBean
    2. JobDetailBean to  JobDetailFactoryBean