1 Reply Latest reply on Feb 11, 2008 9:43 AM by Alexander Hartner

    Timer Service

    Livia Santos Newbie

      Hi!

      I'm trying to create a schedule service at jboss 4.2.1 but I'm not sure what to do.
      I need a service to be started by the application server that runs every half an hour.

      I wrote a class but the problem is when I start jboss, I have the following error message:

      10:11:11,280 ERROR [TimerServiceImpl] Cannot create txtimer
      java.lang.IllegalStateException: Unable to persist timer


      Caused by: java.sql.SQLException: Unique constraint violation: in statement [insert into TIMERS (TIMERID,TARGETID,INITIALDATE,TIMERINTERVAL,INSTANCEPK,INFO) values (?,?,?,?,?,?)]


      Here is the class:

      @Service
      @Management(AtividadeTimerServiceManagement.class)
      public class AtividadeTimerServiceBean implements AtividadeTimerServiceLocal,
       AtividadeTimerServiceManagement {
      
       @Resource
       private TimerService timerService;
      
       public void create() throws Exception {
       this.timerService.createTimer(15*60*1000, 5*60*1000, null);
       }
      
       public void destroy() {
      
       }
      
       public void start() throws Exception {
       }
      
       public void stop() {
       }
      
       @Timeout
       public void monitorPeriodoCadastral(Timer timer) {
       log.info("monitorPeriodoCadastral...");
       }
      }
      


      Does anybody have any idea why am I getting this error message?
      Thanks!