【问题标题】:How do I force an exception in mule [closed]如何在骡子中强制异常[关闭]
【发布时间】:2023-04-08 07:23:02
【问题描述】:

我使用的是 3.2 版。当肥皂故障从服务返回时,我想记录错误并强制全局异常。我尝试使用
<test:component throwException="true" />。虽然它确实强制执行异常,但它也会在我的日志中生成大量消息(见下文)。我需要清理它或找到更好的方法来强制执行异常。

>>>>>>>>>>>>>>>>>>>>>>>>>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)
********************************************************************************

【问题讨论】:

    标签: mule


    【解决方案1】:

    您可以从 Groovy 脚本组件中抛出任何异常:

    <scripting:component doc:name="Script">
        <scripting:script engine="Groovy"><![CDATA[
            throw new IllegalArgumentException('bad arg')
        ]]></scripting:script>
    </scripting:component>
    

    【讨论】:

    • 请举个例子
    • 谢谢。这是有道理的。
    • 请提供/建议的例子来处理这个('bad arg')
    猜你喜欢
    • 2020-09-17
    • 2016-03-18
    • 1970-01-01
    • 1970-01-01
    • 2016-10-10
    • 1970-01-01
    • 1970-01-01
    • 2013-03-03
    • 1970-01-01
    相关资源
    最近更新 更多