Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-11248

EJB Timer is not properly set when the database is different than the defaults

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 15.0.0.Beta1, 15.0.0.Final
    • 14.0.0.Final
    • EJB
    • None

    Description

      When using EJB timers the tables will be created during startup based on the database type.
      If we set the database different than the default names, i.e. mariadb, mysql, it will fail:

      timer-store example:

                  <timer-service thread-pool-name="default" default-data-store="ejb_timer-EJB_TIMER_ds">
      		<data-stores>
      		    <file-data-store name="default-file-store" path="timer-service-data" relative-to="jboss.server.data.dir"/>
      		    <database-data-store name="ejb_timer-EJB_TIMER_ds" datasource-jndi-name="java:jboss/datasources/jbpmDS_EJBTimer" database="mysql57" partition="ejb_timer-EJB_TIMER_part" refresh-interval="30000"/>
      		</data-stores>
      	   </timer-service>
      

      Issue:

      2018-10-25 13:06:57,541 DEBUG [org.jboss.as.ejb3.timer] (MSC service thread 1-5) Database dialect 'mysql57' read from configuration
      ...
      
      2018-10-25 13:06:58,056 INFO  [org.jboss.ws.common.management] (MSC service thread 1-4) JBWS022052: Starting JBossWS 5.2.3.Final (Apache CXF 3.2.5.jbossorg-1) 
      2018-10-25 13:06:58,222 ERROR [org.jboss.as.ejb3.timer] (MSC service thread 1-5) WFLYEJB0163: Cannot create table for timer persistence: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PRIMARY KEY NOT NULL, TIMED_OBJECT_ID VARCHAR NOT NULL, INITIAL_DATE TIMESTAMP, ' at line 1
      	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
      	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
      	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
      	at com.mysql.cj.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1354)
      	at com.mysql.cj.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2127)
      	at com.mysql.cj.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1264)
      	at com.mysql.cj.jdbc.StatementWrapper.executeUpdate(StatementWrapper.java:628)
      	at org.jboss.jca.adapters.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:430)
      	at org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.checkDatabase(DatabaseTimerPersistence.java:292)
      	at org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.start(DatabaseTimerPersistence.java:166)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
      	at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
      	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
      	at java.lang.Thread.run(Thread.java:748)
      
      

      This issue was spotted on OpenShift environment, the behavior there is to use as the database type on the datastore the same value than the datasource driver name, in this specific case, we we're trying a custom mysql jdbc driver version and named it to mysql57.

      Attachments

        Issue Links

          Activity

            People

              rhn-support-fspolti Filippe Spolti
              rhn-support-fspolti Filippe Spolti
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: