Search code examples
javaoraclejboss-eap-7ejb-timer

JBoss timer clustered store not starting on Oracle


I'm trying to configure a clustered store for EJB timers with JBoss EAP 7.4 (patched to JBoss EAP 7.4.5.GA WildFly Core 15.0.13.Final-redhat-00001).

Everything is working fine when I use my Postgres datasource and the clustered store as such:

<database-data-store name="clustered-store" datasource-jndi-name="java:jboss/datasources/postgresDS" database="postgresql" partition="timer"/>

But if I try and use Oracle instead

<database-data-store name="clustered-store" datasource-jndi-name="java:jboss/datasources/oracleDS" database="oracle" partition="timer"/>

I get this exception on startup

10:18:36,279 (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/oracleDS]
10:18:36,279 (MSC service thread 1-6) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
10:18:36,282 (MSC service thread 1-5) MSC000001: Failed to start service org.wildfly.ejb3.timer-service.timer-persistence-service.clustered-store: org.jboss.msc.service.StartException in service org.wildfly.ejb3.timer-service.timer-persistence-service.clustered-store: Failed to start service
    at [email protected]//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1731)
    at [email protected]//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
    at [email protected]//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at [email protected]//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
    at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
    at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
    at [email protected]//org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.adjustCreateAutoTimerStatement(DatabaseTimerPersistence.java:323)
    at [email protected]//org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.identifyDialect(DatabaseTimerPersistence.java:311)
    at [email protected]//org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.investigateDialect(DatabaseTimerPersistence.java:280)
    at [email protected]//org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.start(DatabaseTimerPersistence.java:187)
    at [email protected]//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
    at [email protected]//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
    ... 6 more

I've double checked timer-sql.properties and it seems "oracle" is the right name to use for JBoss to locate the appropriate script.

Since everything is working fine Postgres I'm assuming it's not something to do with the configuration of the beans themselves or @Schedule, and I fail to see why changing the underlying datasource would cause this.

Any help much appreciated.


Solution

  • Finally got to the bottom of it, it's a bug in DatabaseTimerPersistence which is present in JBoss EAP 7.4.5 and was fixed in April 2022.

    Details: adjustCreateAutoTimerStatement() was being called for DB2 and Oracle, but before loadSqlProperties() had been called, hence the NPE when trying to access the sql Properties object.

    Patching to 7.4.9 fixed it.