5 Replies Latest reply on May 17, 2007 9:54 AM by cjunge

    Poblem invoking actions concurrently

    cjunge

      Hi, I have a problem invoking actions from an ESB aware web service.

      Since I need to invoke several actions that invoke different web services that need to be located using the UDDI registry, I decided to use threads to do it in a parallel fashion. Each thread locates the service in the registry, invokes it and then returns the result to the ESB aware service via a Courrier.

      It works flawlessly when I invoke it only once, but if I invoke the service many times concurrently I get the following exceptions.

      org.jboss.soa.esb.actions.ActionProcessingException: Unexpected invocation target exception from processor
      at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:123)
      at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProcessor.process(OverriddenActionLifecycleProcessor.java:74)
      at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:206)
      at org.jboss.soa.esb.listeners.message.MessageAwareListener$1.run(MessageAwareListener.java:300)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NullPointerException
      at cl.met.StocksAction.GetStocks(StocksAction.java:60)
      at sun.reflect.GeneratedMethodAccessor119.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:102)
      ... 6 more

      Where StocksAction.java:60 is:

      String codProd = (String) params[0];


      I am passing the parameters as an Object array (Object []) as discussed previously in this forum. I am retrieving the parmeters from the message in the following way.

      Object [] params = (Object[]) message.getBody().get("params");


      Having used the add function in the sender off course:

      Message requestMessage = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
      requestMessage.getBody().add("params",params);


      I also get an error while trying to return the message from the action to the ESB aware web service.

      org.jboss.soa.esb.actions.ActionProcessingException: Unexpected invocation target exception from processor
      at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:123)
      at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProcessor.process(OverriddenActionLifecycleProcessor.java:74)
      at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:206)
      at org.jboss.soa.esb.listeners.message.MessageAwareListener$1.run(MessageAwareListener.java:300)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: org.jboss.soa.esb.couriers.CourierException: No deliver courier
      at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.deliver(TwoWayCourierImpl.java:157)
      at cl.met.PreciosAction.GetPrecios(PreciosAction.java:90)
      at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:102)
      ... 6 more


      Where PreciosAction.java:90 is:

      EPR replyEPR = message.getHeader().getCall().getReplyTo();
      Courier courier = CourierFactory.getCourier(replyEPR);
      courier.deliver(responseMessage); // this is line 90
      CourierUtil.cleanCourier(courier);


      The ESB aware web service sends the message to the action using a TwoWayCourrier and setting a propper replyEPR to the message as explained by the webservice quickstart.

      EPR replyEPR = CourierUtil.getTemporaryReplyToEpr(requestEPR);
      requestMessage.getHeader().getCall().setReplyTo(replyEPR);


      Since this only happens when I make simultaneous calls to the web service I assume there is a problem with my threads, but they don't share pointers to any data so there shouldn't be any data races.

      I have one EsbCallThread that receives a category, a service and an Obeject[] and sends the message to the corresponding action adding the array of objects to the message as described earlier in this post.

      Any ideas why this could be happening?

      Thanks,
      Cristian