[jboss-user] [JBoss Seam] - @Restrict preventing @Asynchronous method from execution

lowecg2004 do-not-reply at jboss.com
Wed Mar 14 18:24:41 EDT 2007


Hi,

I have a simple asynchronous call which is failing with the following message:

21:59:44,765 ERROR [TimerImpl] Error invoking ejbTimeout: javax.ejb.EJBException: java.lang.NullPointerException: facesContext

The error is thrown when the @Restrict annotation is present.  If I remove it then the method executes fine.

The async bean has been stripped down to the following (and still exhibits the error):

  | @Local
  | public interface PaymentHandler {  
  | 	@Asynchronous
  | 	void processOrderPayment();
  | }
  | 
  | @Stateless
  | @Name("paymentHandler")
  | @Restrict("#{identity.loggedIn}")
  | public class PaymentHandlerHome implements PaymentHandler, Serializable {
  | 	private static final long serialVersionUID = -1727810612672179507L;
  | 
  | 	public void processOrderPayment() {
  | 		System.out.println("****** processOrderPayment");
  | 	}
  | }

Invocation is from the following action:

@Name("paymentBean")
  | @Stateful
  | @Restrict("#{identity.loggedIn}")
  | public class PaymentBeanHome implements PaymentBean, Serializable {
  | 	
  | 	@In(create = true)
  | 	private PaymentHandler paymentHandler;
  | 	
  | 	@In
  | 	private FacesContext facesContext;
  | 
  | 	@Create
  | 	public void initialise() {
  | 	}
  | 
  | 	@Destroy
  | 	@Remove
  | 	public void destroy() {
  | 	}
  | 
  | 
  | 	public String submitPayment(final String outcome) {
  | 		...
  | 
  | 		// attempt to submit the payment for processing.
  | 		submitPaymentRequest();
  | 
  | 		...
  | 
  | 		return outcome;
  | 	}
  | 
  | 	private void submitPaymentRequest() {
  | 		paymentHandler.processOrderPayment();
  | 	}
  | 
  | }

I am logged in at this point and the bean that invokes the asynch method has the same @Restrict present.  For obvious reasons, I would really like to guard this action.  Am I doing anything wrong?

Cheers,

Chris.

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

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



More information about the jboss-user mailing list