Ginka
Ginka

Reputation: 570

Quartz.net SchedulerConfigException on Startup

I am quite new to Quartz.net so I was trying to make a simple console application to test the AdoJobStore functionality, anyway I get an exception when i start the scheduler just after i have scheduled a job

this is my code

using System;
using System.Collections.Specialized;
using System.Linq;
using Quartz;
using Quartz.Impl;

namespace Tester
{
    class Program
    {
        static void Main(string[] args)
        {
            NameValueCollection properties = new NameValueCollection();

            properties["quartz.scheduler.instanceName"] = "TestScheduler";
            properties["quartz.scheduler.instanceId"] = "instance_one";
            properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
            properties["quartz.threadPool.threadCount"] = "5";
            properties["quartz.threadPool.threadPriority"] = "Normal";
            properties["quartz.jobStore.misfireThreshold"] = "60000";
            properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
            properties["quartz.jobStore.useProperties"] = "true";
            properties["quartz.jobStore.dataSource"] = "default";
            properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
            properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";
            properties["quartz.dataSource.default.connectionString"] = "Server=SEVEN107;Initial Catalog=Quartz;Persist Security Info=True;User ID=sa;Password=P2ssw0rd";
            properties["quartz.dataSource.default.provider"] = "SqlServer-20";

            ISchedulerFactory schedFact = new StdSchedulerFactory(properties);

            IScheduler sched = schedFact.GetScheduler();

            JobDetail jobDetail = new JobDetail("myJob", "default", typeof(DumbJob));
            jobDetail.Durable = false;
            jobDetail.Volatile = false;
            jobDetail.RequestsRecovery = false;

            Trigger trigger = TriggerUtils.MakeSecondlyTrigger();
            trigger.StartTimeUtc = DateTime.UtcNow.AddSeconds(5);
            trigger.Name = "myTrigger";
            trigger.Group = "default";

            if (!sched.GetJobNames("default").Contains("myJob"))
                sched.ScheduleJob(jobDetail, trigger);

            sched.Start();

            Console.ReadKey();
            sched.Shutdown();
        }
    }

    public class DumbJob : IJob
    {
        public void Execute(JobExecutionContext context)
        {
            Console.WriteLine("DumbJob Executed");
        }
    }
}

And this is the exception i get once sched.Start(); is called

<Exception dateTime="2011-04-20T10:02:16">
  <Message>Failure occured during job recovery.</Message>
  <InnerException>
    <Message>Couldn't store trigger 'myTrigger' for 'myJob' job: Could not load requested type: Tester.DumbJob, Quartz</Message>
    <InnerException>
      <Message>Could not load requested type: Tester.DumbJob, Quartz</Message>
      <InnerException />
      <CallStack>   in Quartz.Simpl.CascadingClassLoadHelper.LoadType(String name)
   in Quartz.Impl.AdoJobStore.StdAdoDelegate.SelectJobDetail(ConnectionAndTransactionHolder conn, String jobName, String groupName, ITypeLoadHelper loadHelper)
   in Quartz.Impl.AdoJobStore.JobStoreSupport.StoreTrigger(ConnectionAndTransactionHolder conn, SchedulingContext ctxt, Trigger newTrigger, JobDetail job, Boolean replaceExisting, String state, Boolean forceState, Boolean recovering)</CallStack>
    </InnerException>
    <CallStack>   in Quartz.Impl.AdoJobStore.JobStoreSupport.StoreTrigger(ConnectionAndTransactionHolder conn, SchedulingContext ctxt, Trigger newTrigger, JobDetail job, Boolean replaceExisting, String state, Boolean forceState, Boolean recovering)
   in Quartz.Impl.AdoJobStore.JobStoreSupport.DoUpdateOfMisfiredTrigger(ConnectionAndTransactionHolder conn, SchedulingContext ctxt, Trigger trig, Boolean forceState, String newStateIfNotComplete, Boolean recovering)
   in Quartz.Impl.AdoJobStore.JobStoreSupport.RecoverMisfiredJobs(ConnectionAndTransactionHolder conn, Boolean recovering)
   in Quartz.Impl.AdoJobStore.JobStoreSupport.RecoverJobs(ConnectionAndTransactionHolder conn)
   in Quartz.Impl.AdoJobStore.JobStoreSupport.RecoverJobsCallback.Execute(ConnectionAndTransactionHolder conn)
   in Quartz.Impl.AdoJobStore.JobStoreSupport.ExecuteInNonManagedTXLockCallback.Execute(ConnectionAndTransactionHolder conn)
   in Quartz.Impl.AdoJobStore.JobStoreSupport.ExecuteInNonManagedTXLock(String lockName, ITransactionCallback txCallback)
   in Quartz.Impl.AdoJobStore.JobStoreSupport.ExecuteInNonManagedTXLock(String lockName, IVoidTransactionCallback txCallback)
   in Quartz.Impl.AdoJobStore.JobStoreSupport.RecoverJobs()
   in Quartz.Impl.AdoJobStore.JobStoreSupport.SchedulerStarted()</CallStack>
  </InnerException>
  <CallStack>   in Quartz.Impl.AdoJobStore.JobStoreSupport.SchedulerStarted()
   in Quartz.Core.QuartzScheduler.Start()
   in Quartz.Impl.StdScheduler.Start()
   in Tester.Program.Main(String[] args) in ..\Quartz\Program.cs:riga 60</CallStack>
</Exception>

Any thoughts would be awesome!

Upvotes: 1

Views: 2426

Answers (1)

Eben Roux
Eben Roux

Reputation: 13256

Firstly, I don't use Quartz --- but:

Is your exe called Quartz.exe? If Quartz.NET has an assembly called Quartz.dll it'll explain your issue. To be safe name your exe assembly something else.

Upvotes: 2

Related Questions