6 Replies Latest reply on May 23, 2011 5:44 AM by Tom Fennelly

    Spring action incompatible with @Process method parameters?

    Lean Tino Newbie

      Hi all,

       

      I'm playing with an JBoss ESB service action which extends from AbstractSpringAction as follows:

       

      public class MySpringAction extends AbstractSpringAction {

       

          public MySpringAction(ConfigTree config) {

              configTree = config;

          }

       

          @Process

          public String testAction(@BodyParam String bodyParam1) {

              return "from testAction: " + bodyParam1;

          }

       

          @Process

          public String testAction2(@BodyParam String bodyParam2) {

              return "from testAction2: " + bodyParam2;

          }

      }

       

       

      My action-related jboss-esb.xml snippet is defined as follows:

       

          <action class="myapp.MySpringAction" name="testAction" process="testAction">

           <property name="springContextXml" value="spring-context.xml"/>

          </action>

          <action class="myapp.MySpringAction" name="testAction2" process="testAction2">

           <property name="springContextXml" value="spring-context.xml"/>

          </action>

       

       

      spring-context.xml file references a simple POJO.

       

       

      When I try to deploy generated .esb into JBoss, an exception is raised showing it is looking for action methods with Message parameters instead declared ones, disregarding @BodyParam annotations.

       

       

      Deployment "jboss.esb.vfszip:/C:/jboss-soa-p-5/jboss-as/server/default/deploy/springServ-1.0-SNAPSHOT.esb/" is in error due to the following reason(s): java.lang.NoSuchMethodException: myapp.MySpringAction.testAction(org.jboss.soa.esb.message.Message)

       

      Would you tell me what's wrong here?

       

      Thanks!

        • 1. Spring action incompatible with @Process method parameters?
          Tom Cunningham Master

          What version of JBoss ESB are you using?

          • 2. Spring action incompatible with @Process method parameters?
            Lean Tino Newbie

            Rosetta says: "Version=4.9_SOA_5.1"

            • 3. Spring action incompatible with @Process method parameters?
              Tom Cunningham Master

              http://community.jboss.org/wiki/JBossESBActionAnnotations

               

              This looks like the requested form (rather than just @BodyParam, you need to specify the named location in the message body.


                  @Process

                  public OrderAck storeOrder(@BodyParam("order-header") OrderHeader orderHeader, @BodyParam("order-items") OrderItems orderItems) {
                      // process the order parameters and return an ack...
                  }

              • 4. Spring action incompatible with @Process method parameters?
                Lean Tino Newbie

                Changed to explicit param location as in:

                   

                @Process

                    public String testAction(@BodyParam("body-param1") String bodyParam1) {

                        return "from testAction: " + bodyParam1;

                    }

                 

                 

                    @Process

                    public String testAction2(@BodyParam("body-param2") String bodyParam2) {

                        return "from testAction2: " + bodyParam2;

                    }

                 

                 

                ... but got the same exception. Follows a more complete stack trace:

                 

                15:58:57,560 INFO  [EsbDeployment] Starting ESB Deployment 'myApp-1.0-SNAPSHOT.esb'

                15:58:57,572 ERROR [AbstractKernelController] Error installing to Start: name=jboss.esb.vfszip:/C:/jboss-soa-p-5/jboss-as/server/default/deploy/myApp-1.0-SNAPSHOT.esb/ state=Create

                org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException: Error configuring action processing pipeline

                    at org.jboss.soa.esb.listeners.message.MessageAwareListener.doInitialise(MessageAwareListener.java:192)

                    at org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle.initialise(AbstractManagedLifecycle.java:133)

                    at org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController.initialiseInstances(ManagedLifecycleController.java:109)

                (...)

                Caused by: org.jboss.soa.esb.ConfigurationException: Invalid processor method in configuration

                    at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.getMethodInfo(ActionProcessorMethodInfo.java:262)

                    at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProcessor.<init>(OverriddenActionLifecycleProcessor.java:58)

                    at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.<init>(ActionProcessingPipeline.java:305)

                    at org.jboss.soa.esb.listeners.message.MessageAwareListener.doInitialise(MessageAwareListener.java:186)

                    ... 61 more

                Caused by: java.lang.NoSuchMethodException: myapp.MySpringAction.testAction(org.jboss.soa.esb.message.Message)

                    at java.lang.Class.getMethod(Class.java:1605)

                    at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.getMethod(ActionProcessorMethodInfo.java:303)

                    at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.getMethods(ActionProcessorMethodInfo.java:285)

                    at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.getMethodInfo(ActionProcessorMethodInfo.java:250)

                    ... 64 more

                • 5. Re: Spring action incompatible with @Process method parameters?
                  Tom Cunningham Master

                  Maybe it is the two process methods in the same class?    I'm not sure.      I do know that you can take a look at the http_gateway quickstart for a working example of these annotations in action.       Maybe start there and build off of it?

                   

                  The other thing is that since it appears you are using SOA-P, maybe you have a support contract?     If you have one, I'd definitely work your issues through support for the quicker and more reliable response times.

                  • 6. Spring action incompatible with @Process method parameters?
                    Tom Fennelly Master

                    I'm fairly sure your issue is related to the fact that your class is implementing the ActionLifecycle interface (through AbstractSpringAction) and so is not being treated as a Bean/POJO action.  If you want to use the AbstractSpringAction then you can't use the the bean component annotations i.e. you must implement a basic action.