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

9 comments:

  1. Good reference. I also want to add that you also need to change SimpleTriggerBean to SimpleTriggerFactoryBean

    ReplyDelete
  2. tried to change the code .....JobDetail jobDetail = cronTriggerFactBean.getJobDetail(); is giving compile error.....

    ReplyDelete
  3. Thông tin thật thông dụng, cảm ơn bạn đã share.
    Xem thêm website : Bán đá thạch anh

    ReplyDelete
  4. Bài post của Chủ thớt quá hữu ích, cám ơn bạn đã share.
    Thông tin thêm : Thạch anh vụn

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Bài post của Admin quá hữu ích, thank bạn đã chia sẻ.
    Xem tại website : Gia công đá thạch anh

    ReplyDelete
  7. Trí tuệ của chủ thớt thật cần thiết, cám ơn bạn đã chia sẻ.
    Xem thêm tại website: Vòng đeo thạch anh

    ReplyDelete
  8. Kiến thức của tác giả rất hay, cám ơn bạn đã share.
    Xem tại website : Thiềm thừ

    ReplyDelete