4 Replies Latest reply on Oct 4, 2006 5:56 PM by James McClure

    no injection of @Resource TimerService within Entity EJB

    James McClure Newbie

      Greetings,

      I'm working with 4.0.4GA and EJB3 RC9 on Java 1.5.0_06 (WinXP). Have created an entity bean with the container's timer service injected. When I reference the timer service, it is null. Under the same conditions, I am successful at injecting the timer service into both a MDB and a stateless session bean. No errors or warnings in compile or deployment with verbose output, only the NullPointerException when attempting to use the timer service.
      Here is what I am doing (simplified):

      @Entity
      public class MyEntity implements Serializable
      {
       @Resource
       private TimerService timerService;
       ...
      

      Then try to invoke methods on the timer service:
      public createMyTimer()
      {
       try
       {
       if((timerService.getTimers()).isEmpty() == false)
       {
       ...
      

      I assume this annotation/usage is legal. Did not see anything logged in JIRA or a relate forum topic. Anyone seen this or have an answer to this behavior? Thanks.

      James