Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I force an exception in mule [closed]

Tags:

mule

I using version 3.2. When a soap fault returns from a service I want log the error and force the Global Exception. I tried using
<test:component throwException="true" />. While it does force the Exception to execution it also genreates a ton of messages in my log (see below). I need to clean this up or find a better to force the execution of the exception.

>>>>>>>>>>>>>>>>>>>>>>>>>THESE ARE UNWANTED MESSAGES>>>>>>>>>>>>>
INFO  2013-09-08 17:38:05,443 [msr-httpConnector.receiver.02] org.mule.tck.functional.FunctionalTestComponent: 
********************************************************************************
* Message Received in service: BillingAccountProductAssociationRequest.        *
* Content is: <soap:Envelope                                                   *
* xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Faul *
* t><faultc...[100 of 567]                                                     *
********************************************************************************
ERROR 2013-09-08 17:38:05,449 [msr-httpConnector.receiver.02] org.mule.exception.CatchMessagingExceptionStrategy: 
********************************************************************************
Message               : Functional Test Service Exception
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Functional Test Service Exception (org.mule.tck.exceptions.FunctionalTestException)
  org.mule.tck.functional.FunctionalTestComponent:210 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/tck/exceptions/FunctionalTestException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.tck.exceptions.FunctionalTestException: Functional Test Service Exception
    at org.mule.tck.functional.FunctionalTestComponent.throwException(FunctionalTestComponent.java:210)
    at org.mule.tck.functional.FunctionalTestComponent.onCall(FunctionalTestComponent.java:134)
    at org.mule.model.resolvers.CallableEntryPointResolver.invoke(CallableEntryPointResolver.java:50)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
like image 458
Randall Swinson Avatar asked Sep 08 '13 23:09

Randall Swinson


People also ask

What is exception handling mule4?

In Mule 4, error handling is no longer limited to a Java exception handling process that requires you to check the source code or force an error in order to understand what happened. Though Java Throwable errors and exceptions are still available, Mule 4 introduces a formal Error concept that's easier to use.

How do you handle errors in Mule?

You can handle Mule messaging errors in more than one way: You can rely on the default error handling mechanism. Within a flow, you can set up On-Error components (On Error Continue and On Error Propagate) inside the flow's built-in Error Handler component.

How will you rollback a failed transaction in Mule?

First, create a Mule Configuration File and add to it your global rollback exception strategy. Then add a Reference Exception Strategy to a flow to apply the error handling behavior of your new global rollback exception strategy.


1 Answers

You can throw any exception from a Groovy scripting component:

<scripting:component doc:name="Script">
    <scripting:script engine="Groovy"><![CDATA[
        throw new IllegalArgumentException('bad arg')
    ]]></scripting:script>
</scripting:component>
like image 173
David Dossot Avatar answered Oct 25 '22 23:10

David Dossot