2 Replies Latest reply on Jul 24, 2006 10:09 AM by wolfc

    TimerService Injection Failure

      Added a timer service to an Entity bean but when calling rotate() I get a null pointer exception. The container failed to inject a TimerService for me.

      @Entity public class Planet implements Serializable
       @Resource TimerService timerService;
       public rotate()
       timerService.createTimer(60000, "minute timer"); // NFG: timerService not initialized

        • 1. Re: TimerService Injection Failure

          Forgot "void" on rotate() when typing in the example but the actual problem is a null timerService variable, as stated.

          • 2. Re: TimerService Injection Failure

            TimerService on 3.0 entities are not supported.

            From JSR 220: Enterprise JavaBeans TM, Version 3.0, Final Release, Chapter 18.2 2nd paragraph:

            Timers can be created for stateless session beans, message-driven beans, and 2.1 entity beans.
            Timers cannot be created for stateful session beans[94] or EJB 3.0 entities.