2 Replies Latest reply on Jul 31, 2006 5:53 PM by tsar_bomba

    Unable to persist timer

      I added a timer service to a stateless EJB:

      private @Resource TimerService timer;
      public void startTimer()
       timer.createTimer(1000, 1000, "clock");
      @Timeout public void timeou(Timer timer)

      This works wonderfully but there's a problem that ONLY appears when I'm running on Windows. I do not run in to this problem using the same app on OS X. I am using JBoss 4.0.4.GA. I get this error after killing and restarting JBoss a few times:

      08:50:19,421 ERROR [TimerServiceImpl] Cannot create txtimer
      java.lang.IllegalStateException: Unable to persist timer
      at org.jboss.ejb.txtimer.DatabasePersistencePolicy.insertTimer(DatabasePersistencePolicy.java:126)

      I am not given an opportunity to catch this exception (tried that) before it chokes so I cannot retry the create call. I resolve the problem by taking a clean copy of the default configuration and then redeploying my app.

      Any suggestions appreciated.

        • 1. Re: Unable to persist timer

          Here's the SQL exception from the stack trace.

          Caused by: java.sql.SQLException: Unique constraint violation: in statement
          at org.hsqldb.jdbc.Util.throwError(Unknown Source)
          at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)

          • 2. Re: Unable to persist timer

            It's an ongoing issue for which I've been unable to get an answer here for also. The best thing you can do is go into the HSQL database manager through the JMX console and delete all timers before re-deploying your app.