question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quartz exception after upgrade

See original GitHub issue

After upgrading to latest OpenIddict (3.0.3) and Quartz (3.3.1), seeing below runtime exception on startup.

This doesn’t occur with 3.0.2 and Quartz 3.2.4. Rolling back is viable workaround. Happy to provide further details.

Configuration:

// Add Quartz.NET for recurring datastore pruning
services.AddQuartz(options =>
{
    options.UseMicrosoftDependencyInjectionJobFactory();
    options.UseSimpleTypeLoader();
    options.UseInMemoryStore();
});

// Register the Quartz.NET service and configure it to block shutdown until jobs are complete
services.AddQuartzHostedService(options => options.WaitForJobsToComplete = true);

...

services.AddOpenIddict()
    .AddCore(options =>
    {
        // Enable Quartz.NET integration
        options.UseQuartz(options =>
        {
            options.SetMinimumTokenLifespan(environment.IsDevelopment() ? TimeSpan.FromHours(1) : TimeSpan.FromHours(24));
        });
    })
...

Exception:

An error occurred instantiating job to be executed. job= 'OpenIddict.Quartz.OpenIddictQuartzJob, message=Multiple constructors accepting all given argument types have been found in type 'OpenIddict.Quartz.OpenIddictQuartzJob'. There should only be one applicable constructor.'
Quartz.SchedulerException: Problem instantiating type 'OpenIddict.Quartz.OpenIddictQuartzJob: Multiple constructors accepting all given argument types have been found in type 'OpenIddict.Quartz.OpenIddictQuartzJob'. There should only be one applicable constructor.'
 ---> System.InvalidOperationException: Multiple constructors accepting all given argument types have been found in type 'OpenIddict.Quartz.OpenIddictQuartzJob'. There should only be one applicable constructor.
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.TryFindMatchingConstructor(Type instanceType, Type[] argumentTypes, ConstructorInfo& matchingConstructor, Nullable`1[]& parameterMap)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type instanceType, Type[] argumentTypes, ConstructorInfo& matchingConstructor, Nullable`1[]& matchingParameterMap)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(Type instanceType, Type[] argumentTypes)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Quartz.Simpl.JobActivatorCache.CreateInstance(IServiceProvider serviceProvider, Type jobType)
   at Quartz.Simpl.PropertySettingJobFactory.NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
   at Quartz.Core.JobRunShell.Initialize(QuartzScheduler sched, CancellationToken cancellationToken)
   --- End of inner exception stack trace --- [See nested exception: System.InvalidOperationException: Multiple constructors accepting all given argument types have been found in type 'OpenIddict.Quartz.OpenIddictQuartzJob'. There should only be one applicable constructor.
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.TryFindMatchingConstructor(Type instanceType, Type[] argumentTypes, ConstructorInfo& matchingConstructor, Nullable`1[]& parameterMap)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type instanceType, Type[] argumentTypes, ConstructorInfo& matchingConstructor, Nullable`1[]& matchingParameterMap)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(Type instanceType, Type[] argumentTypes)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Quartz.Simpl.JobActivatorCache.CreateInstance(IServiceProvider serviceProvider, Type jobType)
   at Quartz.Simpl.PropertySettingJobFactory.NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
   at Quartz.Core.JobRunShell.Initialize(QuartzScheduler sched, CancellationToken cancellationToken)]
[10:58:38 INF] All triggers of Job OpenIddict.Quartz.OpenIddictQuartzJob set to ERROR state.

Further technical details

  • ASP.NET Core version: 5.0.5
  • Visual Studio 16.9

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:22 (11 by maintainers)

github_iconTop GitHub Comments

4reactions
lahmacommented, Apr 9, 2021

@NoahStahl Quartz.NET 3.3.2 is now available on NuGet thanks to great input from both @kevinchalet and @ArturDorochowicz . Please try it out and hopefully your problems are gone now.

1reaction
kevinchaletcommented, Apr 9, 2021

@lahma I just gave it a try and it works like a charm! Thanks for fixing it so fast, much appreciated!

I’ll open a separate thread to track future improvements (like removing the manual scope creation, since Quartz.NET now always creates a scope for us)

Read more comments on GitHub >

github_iconTop Results From Across the Web

2.6.6 Upgrade issue with quartz datasource #31087
After upgrading to 2.6.6, is seems that the datasource is... ... Invocation of init method failed; nested exception is org.quartz.
Read more >
Quartz error after upgrading spring to 5.3.27 and ...
BeanCreationException : Error creating bean with name 'schedulerFactory' defined in ServletContext resource [/WEB-INF/spring/app-standard-config.
Read more >
Upgrade to 6.3 Fails Due to Unable to create the Quartz ...
Exception thrown during upgrade: Unable to create the Quartz trigger com.atlassian.scheduler.SchedulerServiceException: Unable to create the ...
Read more >
Implementing Job Exception Retrying in Quartz.NET
In this blog post, we will be learning how to use Quartz.NET to implement automatic job re-trying when a job runs into an...
Read more >
Best Practices and Tips
Quartz contains an “update check” feature that connects to a server to check if there is a new version of Quartz available for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found