[jboss-user] [JBoss Seam] - Re: Quartz question

mladen.babic do-not-reply at jboss.com
Mon Aug 20 11:46:39 EDT 2007


I'm using Seam 2.0 BETA. Here is fragment of my code:
This method triggers action for sending e-mail:

  | 
  | 	 @Asynchronous
  | 	 @Transactional
  | 	public QuartzTriggerHandle schedule( @Expiration Date when, @IntervalDuration Long min){		 
  | 				for(Order order:orderService.getAllOrders()){
  | 					if(orderService.getOrderForMailing(order)!=null){
  | 						messageAction.sendOrderEmailToBuyer(order);
  | 					}
  | 				}
  | 	
  | 		return null;
  | 	}
  | 
  | 	

And this method  sending e-mail.


  | public void sendOrderEmailToBuyer(Order order) {
  | 		try {
  | 			User buyer = order.getBuyer();
  | 			Contexts.getConversationContext().set("currentOrder", order);
  | 			Contexts.getConversationContext().remove("currentOrderItems");
  | 			Contexts.getConversationContext().set("recipient", buyer);
  | 			Contexts.getConversationContext().set("changedstatus", chandedstatus);
  | 			
  | 			log.info("Email was sent successfuly to %1", buyer.getEmail());
  | 		} catch (Exception e) {
  | 			e.printStackTrace();
  | 			log.error("ERROR while sending e-mail", e);
  | 		}
  | 	}

Method sendOrderEmailToBuyer works fine when  I clicked  on button directly.Problem is when  quartz action triggered this method for sending mail it trows error  which I post above.Info:Quartz class starts when server starts.

Tnx,
mb

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

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



More information about the jboss-user mailing list