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

Use of schedule expression start/end date for (Database) persistent calendar timers fail if the server is restarted and the timer reloaded

XMLWordPrintable

    • Hide

      Create a Calendartimer with the programatic API and set start or end for the ScheduleExpression

      Show
      Create a Calendartimer with the programatic API and set start or end for the ScheduleExpression

      If Calendar timers are created programatically it is possible to use the javax.ejb.ScheduleExpression and set start() end() as a Date.
      If the timer is persistent and the database is Oracle (here 12c ojdbc7 driver) a server restart will show the following Exception is:

      13:55:00,450 WARN [org.jboss.as.ejb3.timer] (ServerService Thread Pool – 63) WFLYEJB0161: Failed to reinstate timer 'ejb31-timer.ejb31-timer.SimpleScheduleSingletonTimerBean' (id=bd2e59a0-bdf6-43a1-9241-fd3a0b3a72da) from its persistent state: java.sql.SQLException: Invalid conversion requested
      at oracle.jdbc.driver.CharCommonAccessor.getTimestamp(CharCommonAccessor.java:420)
      at oracle.jdbc.driver.T4CVarcharAccessor.getTimestamp(T4CVarcharAccessor.java:644)
      at oracle.jdbc.driver.GeneratedStatement.getTimestamp(GeneratedStatement.java:360)
      at oracle.jdbc.driver.GeneratedScrollableResultSet.getTimestamp(GeneratedScrollableResultSet.java:1008)
      at org.jboss.jca.adapters.jdbc.WrappedResultSet.getTimestamp(WrappedResultSet.java:2140)
      at org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.timerFromResult(DatabaseTimerPersistence.java:535)
      at org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.loadActiveTimers(DatabaseTimerPersistence.java:452)
      at org.jboss.as.ejb3.timerservice.TimerServiceImpl.getActivePersistentTimers(TimerServiceImpl.java:953)
      at org.jboss.as.ejb3.timerservice.TimerServiceImpl.restoreTimers(TimerServiceImpl.java:693)
      at org.jboss.as.ejb3.timerservice.TimerServiceImpl.activate(TimerServiceImpl.java:225)
      at org.jboss.as.ejb3.component.EJBComponent.start(EJBComponent.java:588)
      at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:133)
      at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:748)
      at org.jboss.threads.JBossThread.run(JBossThread.java:320)
      Caused by: java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
      at java.sql.Timestamp.valueOf(Timestamp.java:237)
      at oracle.jdbc.driver.CharCommonAccessor.getTimestamp(CharCommonAccessor.java:415)
      ... 18 more

      As a result the timer seems created with a new id and the entry within the timer-table is duplicated.

              rhn-support-wfink Wolf Fink
              rhn-support-wfink Wolf Fink
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: