0 Replies Latest reply on Feb 8, 2007 4:29 PM by go_rags

    SessionContext and TimerService

    go_rags

      Hi,

      I am using JBossAS 4.0.3 SP1 in our product and recently tried to add a timer service to it. I am having problem retrieving the session context for writing a Timer Service. I am getting a NULL value injected for both the TimerService and SessionContext, is there a way to work around it.

      I am invoking the startPolling() method on startup from a servlet.

      
      @Stateless
      @Remote(IRSSPoller.class)
      public class RSSPoller implements IRSSPoller {
      
       private @Resource
       SessionContext ctx;
      
       private @Resource
       TimerService tms;
      
       private @PersistenceContext
       EntityManager _entityManager;
      
      
       public void startPolling() {
      
       if (ctx == null) System.err.println("SessionContext is NULL!!");
       if (tms == null) System.err.println("TimerService is NULL!!");
      
       if (ctx != null) {
       ctx.getTimerService().createTimer(new Date(),
       milliseconds, com.nukore.hub.rss.RSSPoller.class);
       }
       }
      
       @Timeout
       public void timeoutHandler(Timer timer) {
      
       //Timer Method....
      
       }
      
      }
      
      



      Thanks in advance.

      -
      Raghu.