1 Reply Latest reply on Mar 8, 2005 11:19 AM by Bill Burke

    EJB Timer gives transaction warning?

    Nicolai Wadstrom Newbie

      Using the EJB Timer service I get a warning exception about timer not being registered with transaction (I also tried to add code to start a transaction inside the timeout method, but this gives the same result). Trying to start a User transaction before, by calling sessionContext.getUserTransaction().begin(), throws an java.lang.IllegalStateException: it is illegal to inject UserTransaction into a CMT bean).

      Any ideas?

      00:02:38,459 WARN [TimerImpl] Timer was not registered with Tx, reseting state: [id=1target=[target=jboss.j2ee:service=EJB3,name=
      com.saguru.searchengine.impl.SearchEngineEJBImpl],remaining=-754,periode=2000,in_timeout]
      



      The EJB is a stateless EJB, (just marked with the @Stateless annotation), the timeout and business method looks like:

      @javax.ejb.Timeout
      public void ejbTimeout(javax.ejb.Timer timer)
      {
       System.out.println( this.getClass().getName() + "@" + new java.util.Date() + ": Processing..." );
      
      
      
      }
      
      public void businessMethod()
      {
      getSessionContext().getTimerService().createTimer( 100L, 2000L, null );
      }
      
      



      / Nicolai