quarkus: NullPointerException when upgrading to 2.7.0 with Quartz in JDBC_CMT mode

Describe the bug

I had an app running Quarkus 2.6.1 with Quartz scheduler configured like this:

quarkus.quartz.clustered=true
quarkus.quartz.store-type=jdbc_cmt

after upgrading to 2.7.0 I’m getting this error on boot:

2022-02-05 13:18:12,819 ERROR [io.qua.run.Application] (main) Failed to start application (with profile staging): java.lang.NullPointerException
	at io.quarkus.quartz.runtime.QuartzScheduler.<init>(QuartzScheduler.java:206)
	at io.quarkus.quartz.runtime.QuartzScheduler_Bean.create(Unknown Source)
	at io.quarkus.quartz.runtime.QuartzScheduler_Bean.create(Unknown Source)
	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:101)
	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
	at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
	at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26)
	at io.quarkus.quartz.runtime.QuartzScheduler_Observer_start_09e6c17011ef77dec3e1dd9987380b3d946e3db6.notify(Unknown Source)
	at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:320)
	at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:302)
	at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:73)
	at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:128)
	at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:97)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:104)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:67)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:60)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:31)

Please note that the error doesn’t occur with a fresh database (and no qrtz_* tables).

Output of java -version

OpenJDK 11

Quarkus version or git rev

2.7.0

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.6.3

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@gsmet I checked my git log and it was in release 2.1.0

@jendib Yes, the _trigger suffix was removed in this commit in 2.1.CR1. Another workaround would be to append the _trigger suffix to the @Scheduled#identity() value (this should result in the same trigger key in 2.7+). Also note that we don’t guarantee the compatibility for quartz clustering accross major and minor versions of Quarkus.

@mkouba @machi1990 could you make sure this is documented in the migration guide in which this change was introduced?

Yes, it should go into https://github.com/quarkusio/quarkus/wiki/Migration-Guide-2.1.

@KyriacosP From what I remember this _trigger was removed after the 2.x release. I had the same issue too (undocumented breaking change by the way). I may be wrong, but I think the issue I described in this ticket is yet another one. Thanks for the workaround 👍

The Quartz table have been created using this: https://github.com/quartz-scheduler/quartz/blob/master/quartz-core/src/main/resources/org/quartz/impl/jdbcjobstore/tables_postgres.sql

and my scheduled methods look like like:

@Scheduled(cron = "0 1 9 1/1 * ? *", identity = "discord-update-job")
public void discordUpdate() {
  ...
}

I didn’t do anything fancy like editing manually Quartz tables, it’s all default. I’ll try to see if I can make a reproducer.

In any case, it needs fixing. Be it by adding a proper error message.