[jboss-user] [EJB 3.0] - no injection of @Resource TimerService within Entity EJB

jmcclure do-not-reply at jboss.com
Mon Oct 2 19:08:10 EDT 2006


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. 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975631#3975631

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975631

More information about the jboss-user mailing list