[jboss-user] [JBoss Seam] - Need help with Timer in Seam application

nhieb do-not-reply at jboss.com
Fri Jul 27 11:49:28 EDT 2007


Hey guys, i hope somebody would be able to help.
I am using timer service of EJB in a Seam application. When method marked as @TimeOut is called, i am getting 
Error invoking ejbTimeout: javax.ejb.EJBTransactionRolledbackException: java.lang.NullPointerException: facesContext
I have no clue what facesContext it is looking for??? in my bean there is no any links to it. All the methods along work fine, but when @Timeout is called, the methods of ejb services fail with that exception.
The souce code
@SuppressWarnings({"unchecked"})
  | @Stateless
  | @Name("jobsTimerService")
  | public class JobsTimerServiceImpl implements JobsTimerService {
  |     //in hours
  |     public final static int DUE_DATE_EXPIRATION_INTERVAL_IN_HOURS=2;
  | 
  |     @In(create = true)
  |     EmailHelper emailHelper;
  | 
  |     @Resource
  |     javax.ejb.TimerService timerService;
  | 
  |     @EJB
  |     AdditionalService additionalService
  | 
  |     @EJB
  |     UsersService usersService;
  | 
  |     @Logger
  |     private Log log;
  | 
  |     public void createTimer(long intervalDuration, String info) {
  |         Timer timer = timerService.createTimer(intervalDuration, intervalDuration,info);
  |     }
  | 
  |     @Timeout
  |     public void timeout(Timer timer) {
  |         sendNotifications();
  |     }
  | 
  | 
  |     public void sendNotifications(){
  |         List<User> recepients=getRecipients();
  |         //usually it fails in the next method!!!!!
  |         List objects=getObjects();
  |         emailHelper.send(recepients,wires);
  |         }
  | 
  |     }
  | 
  |     public List getObjects(){
  |     //using additionalService, getting the list of objects
  |     }
  | 
  |     public List<User> getRecipients() {
  |      //using usersService.. getting the list of users
  |     }
  | 
  | }
I have killed  a lot time trying to find out what is wrong. If i invoke sendNotifications from UI of application, it works perfectly fine!!
Thanks for attention

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

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



More information about the jboss-user mailing list