SchedulerException with Simple Job

quartz.net, quartz.net-2.0

Solution

I think there are two issues.

Firstly, (despite the example in the migration guide), I think that you need to say which job the trigger is related to, ie call the .ForJob method , for example

ITrigger trigger = TriggerBuilder.Create()
    .WithIdentity("myTrigger", "My Group")
    .WithDescription("My Description")
    .StartAt(startTime)
    .WithSimpleSchedule(x => x.WithIntervalInSeconds(10).RepeatForever())
    .ForJob(job)
    .Build();

Secondly, the syntax you are using to schedule the job only works if the job has previously been added (eg if you have previously called classSched.AddJob(job,true); // or classSched.AddJob(job,false);

If that hasn't already been done, then you need to use the syntax

  classSched.ScheduleJob(job, trigger); 

Problem

I'm trying to get started with Quartz.Net 2.0. A very simple appearing test application is failing with a `SchedulerException` Trigger's related Job's name cannot be null The code is adapted from the Version 2.0 Migration Guide ``` ISchedulerFactory schedFact = new StdSchedulerFactory(); IScheduler classSched = schedFact.GetScheduler(); classSched.Start(); IJobDetail job = JobBuilder.Create<ClassificationJob>() .WithIdentity("myJob", "My Group") .WithDescription("My Description") .Build(); TimeZoneInfo tzUtc = TimeZoneInfo.Utc; DateTime startTime; startTime = DateTime.UtcNow; ITrigger trigger = TriggerBuilder.Create() .WithIdentity("myTrigger", "My Group") .WithDescription("My Description") .StartAt(startTime) .WithSimpleSchedule(x => x.WithIntervalInSeconds(10).RepeatForever()) .Build(); classSched.ScheduleJob(trigger); // Exception on this line ``` Why is this failing?

Original source