You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JobKey jobKey = new JobKey("MyTestJobKey", "TestGroup");
services.AddJob<MyTestJob>(jobKey, j => j
.WithDescription("A test job")
);
This job is properly persisted in the MongoDB database. However, an issue arises when I need to change the class name of MyTestJob.
Once I change the class name (for example from MyTestJob to MyTestJob2) or remove the class altogether and re-run the scheduler, the scheduler factory fails with the following error:
Quartz.JobPersistenceException: Job class cannot be null.
---> System.ArgumentException: Job class cannot be null.
at Quartz.Impl.JobDetailImpl.set_JobType(Type value)
at Quartz.Impl.JobDetailImpl..ctor(JobKey key, Type jobType, String description, Boolean isDurable, Boolean requestsRecovery, JobDataMap jobDataMap, Nullable`1 disallowConcurrentExecution, Nullable`1 persistJobDataAfterExecution)
at Quartz.JobBuilder.Build()
at Quartz.Spi.MongoDbJobStore.Models.JobDetail.GetJobDetail()
at Quartz.Spi.MongoDbJobStore.MongoDbJobStore.ReplaceTriggerInternal(TriggerKey triggerKey, IOperableTrigger newTrigger)
at Quartz.Spi.MongoDbJobStore.MongoDbJobStore.ReplaceTrigger(TriggerKey triggerKey, IOperableTrigger newTrigger, CancellationToken token)
--- End of inner exception stack trace ---
at Quartz.Spi.MongoDbJobStore.MongoDbJobStore.ReplaceTrigger(TriggerKey triggerKey, IOperableTrigger newTrigger, CancellationToken token)
at Quartz.Core.QuartzScheduler.RescheduleJob(TriggerKey triggerKey, ITrigger newTrigger, CancellationToken cancellationToken)
at Quartz.Xml.XMLSchedulingDataProcessor.ScheduleJobs(IScheduler sched, CancellationToken cancellationToken)
at Quartz.ServiceCollectionSchedulerFactory.InitializeScheduler(IScheduler scheduler, CancellationToken cancellationToken)
at Quartz.ServiceCollectionSchedulerFactory.GetScheduler(CancellationToken cancellationToken)
This is expected, as the class name it's trying to restore no longer exists. But is there a way to gracefully handle this and remove or ignore any jobs that no longer have a valid class associated with them from the MongoDB store?
The text was updated successfully, but these errors were encountered:
I currently have a job added like this:
This job is properly persisted in the MongoDB database. However, an issue arises when I need to change the class name of
MyTestJob
.Once I change the class name (for example from
MyTestJob
toMyTestJob2
) or remove the class altogether and re-run the scheduler, the scheduler factory fails with the following error:This is expected, as the class name it's trying to restore no longer exists. But is there a way to gracefully handle this and remove or ignore any jobs that no longer have a valid class associated with them from the MongoDB store?
The text was updated successfully, but these errors were encountered: