Exceptions are caught twice in the JBoss ESB action pipeline

Solution Verified - Updated -

Issue

  • We are going to develop ESB-endpoint Web Services. If there is an exception in the process of service, the ESB will response with error message in default style.
  • However, we want to customize the error message in consistent with our common response message style. So we tried to catch the exception and format the response message in a uniformed way.
        <service category="MyEsbWebServices" description="ESB-endpoint Web Services"
            name="SampleWebService" invmScope="GLOBAL">
            <actions mep="RequestResponse" inXsd="SampleRequest.xsd" outXsd="SampleResponse.xsd">
                <action class="com.example.ws.MyAction1" name="custom-action1">
                    <property name="exceptionMethod" value="processException" />
                </action>
                <action class="org.example.ws.MyAction2" name="custom-action2">
                    <property name="exceptionMethod" value="processException" />
                </action>
            </actions>
        </service>
  • It ends up with the exception handler action will be invoked twice. Please advise how to fix this issue.
  • The com.example.ws.MyAction1 class looks like the following:
public class MyAction1 extends AbstractActionLifecycle {

    public void processException(final Message message, final Throwable th) {
        System.out.println("Something happened: " + th.getMessage());
        try {
            final ServiceInvoker invoker = new ServiceInvoker("MyEsbWebServices", "AnotherSampleService");
            invoker.deliverSync(message, 2000) ;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

Environment

  • Red Hat JBoss SOA Platform (SOA-P) 5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content