May 16, 2012

Quartz Scheduler : Trigger in ERROR state

Recently I was working on an old application which uses Quartz 1.8.x for job scheduling. Quartz is my favourite framework for scheduling. I have worked with Quartz for last 5 years and never ever complained about the implemntation and features. Overall I had good development experience with Quartz.

Yesterday I came across a particular issue in which TRIGGER associated with quartz job was moving to ERROR state all of a sudden after job was executed. This was very surprising as there were no logs and I was completely lost. I went through Quartz source code. Recompiled Quartz jar with more verbose logging added. Even these measures did not help.

Then I looked into SCHEDULER_STATE table and came to know that we had two scheduler instances connecting to the same server. One of these had the latest deployment which had no errors in logs and the other instance had old build which was missing my job implementation.

Magic text logged was 'Error retrieving job, setting trigger state to ERROR., class.method=JobStoreTX.triggerFired'

org.quartz.JobPersistenceException: Couldn't retrieve job because a required class was not found: org.xxx.ClassName [See nested exception: java.lang.ClassNotFoundException: org.xxx.ClassName]

If anyone is worried about Trigger setting to ERROR with no logs check all the instance which connect to quartz database. Most probably there will be an error logged in one of the log files. Setting log level to DEBUG would surely help.

No comments: