Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several exceptions related to GetJobDetail() #48

Open
leonluc-dev opened this issue Jul 5, 2024 · 0 comments
Open

Several exceptions related to GetJobDetail() #48

leonluc-dev opened this issue Jul 5, 2024 · 0 comments

Comments

@leonluc-dev
Copy link

leonluc-dev commented Jul 5, 2024

Afaik, the GetJobDetail() is supposed to return null for invalid jobs. In 3.1.0 (and 4.0.0-preview.3) the GetJobDetail() method raises exceptions instead of returning null in a few cases. While this can be handled when calling GetJobDetails() directly, it causes some internal errors during scheduler initialization as well.

Scenarios:
Job class no longer exists

After removing a job class or changing its class name and restarting the scheduler, the GetJobDetail() raises an exception 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)

JobDataMap difference between v3 and v4

An empty JobDataMap is stored as "{}" in v4.0.0-preview.3 and null in v3.1.0. Because of this migrating from v3.1.0 to v4.0.0-preview.3 with existing jobs in the mongodb store causes the following error:

Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'newJobDataMap')
   at Quartz.JobBuilder.SetJobData(JobDataMap newJobDataMap)
   at Quartz.Spi.MongoDbJobStore.Models.JobDetail.GetJobDetail()
   at Quartz.Spi.MongoDbJobStore.MongoDbJobStore.RetrieveJob(JobKey jobKey, CancellationToken token)
   at Quartz.Xml.XMLSchedulingDataProcessor.ScheduleJobs(IScheduler sched, CancellationToken cancellationToken)
   at Quartz.ServiceCollectionSchedulerFactory.InitializeScheduler(IScheduler scheduler, CancellationToken cancellationToken)
   at Quartz.ServiceCollectionSchedulerFactory.GetScheduler(CancellationToken cancellationToken)
@leonluc-dev leonluc-dev changed the title Jobs created in v3 cause crash in v4 Jobs with empty JobDataMap created in v3 cause crash in v4 Jul 5, 2024
@leonluc-dev leonluc-dev changed the title Jobs with empty JobDataMap created in v3 cause crash in v4 Jobs with empty JobDataMap created in v3 cause exception in v4 Jul 5, 2024
@leonluc-dev leonluc-dev changed the title Jobs with empty JobDataMap created in v3 cause exception in v4 Several exceptions related to GetJobDetail() Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant