Tallan's Technology Blog

Tallan's Top Technologists Share Their Thoughts on Today's Technology Challenges

Quartz.NET Job Scheduler Error: Failure occurred during job recovery

Reddy Kadasani

So, I was trying to hook up Quartz.NET with a Windows Service to provide a scheduled job that would execute on a daily trigger. I am using SQL Server as the persistence store for the jobs and triggers created by quartz.

I deployed and tested it on my local box and everything was working great until I moved it over to the QA box. I installed the service, no errors or warnings. But when I went to start the service, I got an error “The service did not respond in a timely fashion” and the service would not start. Fortuantely for me I had verbose logging turned on and noticed the following error in the log:

Failure occured during job recovery
Stack Trace:   at Quartz.Impl.AdoJobStore.JobStoreSupport.SchedulerStarted()
at Quartz.Core.QuartzScheduler.Start()
at Quartz.Impl.StdScheduler.Start()

I looked at the quartz source to see what was going on. The code that throws the error is below:


public virtual void SchedulerStarted()
{
if (Clustered)
{
clusterManagementThread = new ClusterManager(this);
clusterManagementThread.Initialize();
}
else
{
try
{
RecoverJobs();
}
catch (SchedulerException se)
{
throw new SchedulerConfigException(“Failure occured during job recovery.”, se);
}
}
misfireHandler = new MisfireHandler(this);
misfireHandler.Initialize();
schedulerRunning = true;
}


That sent me down the path to see what was the difference between my local database and the one in the QA environment. Long story short, it was basically that the “QRTZ_LOCKS” table was missing data . Corrected that and everything works fine now.


INSERT INTO [dbo].[QRTZ_LOCKS] VALUES(‘TRIGGER_ACCESS’);
INSERT INTO [dbo].[QRTZ_LOCKS] VALUES(‘JOB_ACCESS’);
INSERT INTO [dbo].[QRTZ_LOCKS] VALUES(‘CALENDAR_ACCESS’);
INSERT INTO [dbo].[QRTZ_LOCKS] VALUES(‘STATE_ACCESS’);
INSERT INTO [dbo].[QRTZ_LOCKS] VALUES(‘MISFIRE_ACCESS’);


So, in case you come across this issue:

1. Look at the connection string and make sure that whether using SQL Server or Windows Authentication, the user has read/write access to the quartz tables

2. Second, make sure you have populated all the necessary data in the Quartz tables.

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

\\\