2017-04-23 67 views
0

我有一個Mule流,它從服務中獲取oauth令牌可能會引發錯誤。然而即使在最後有一個catch異常策略,這個異常也不會被捕獲。有人可以解釋爲什麼沒有發現異常嗎?當我通過SOAP UI使用無效令牌發佈XML來觸發異常時,請求會到達流程,但是不會捕獲異常。相反,我會得到一個指示無效令牌的堆棧跟蹤。這裏是流程:Mule自定義異常類沒有捕捉到一些例外

<flow name="order-query"> 
     <http:listener config-ref="HTTP_config" 
      path="order/request" doc:name="HTTP" /> 
     <flow-ref name="oauth-token-service"> 
     <cxf:jaxws-service doc:name="SPOP SOAP" 
      serviceClass="o.x.p.SpopWS"> 
      <cxf:inInterceptors> 
      <spring:ref bean="HeaderInInterceptor" /> 
     </cxf:inInterceptors> 
     <cxf:outInterceptors> 
      <spring:ref bean="faultOutInterceptor" /> 
      <spring:ref bean="headerOutInterceptor" /> 
     </cxf:outInterceptors> 
     <cxf:outFaultInterceptors> 
      <spring:ref bean="OutSoapFaultInterceptor" /> 
     </cxf:outFaultInterceptors> 
    </cxf:jaxws-service> 
    <scripting:transformer> 
     <scripting:script engine="python"> 
      ... 
     </scripting:script> 
    <scripting:transformer> 
    <catch-exception-strategy> 
     <logger level="INFO" message=" Should be handled here #[payload]"/> 
    </catch-exception-strategy> 
    </flow> 
+0

捕獲中的記錄器語句未打印。我在日誌中的任何地方看不到消息「應該在這裏處理......」 – BreenDeen

回答

0

你確定這個異常沒有抓住? catch-exception-strategy的默認行爲是記錄捕獲的異常。這就是您在日誌中看到堆棧跟蹤的原因。

爲騾子3.8及以上版本:你可以禁用/啓用此行爲或者有一個複選框(記錄異常):

enter image description here

或XML(logException=false):

<catch-exception-strategy logException="false" doc:name="Catch Exception Strategy"> 
    <logger level="INFO" doc:name="Logger"/> 
</catch-exception-strategy> 

for mule 3.7:看看這裏:https://stackoverflow.com/a/42181054/804521

+0

我正在使用版本3.7.3。我得到:org.xml.sax.SAXParseException:cvc-complex-type.3.2.2:屬性'logException'不允許出現在元素'catch-exception-strategy'中。 – BreenDeen

+0

嗯...根據[文檔](https://docs.mulesoft.com/mule-user-guide/v/3.7/catch-exception-strategy#configcatchstrat)'Log Exceptions'支持3.7(儘管沒有文檔中的xml示例)。 – Yevgeniy

+0

但是你是對的,當我將運行時從3.8切換到3.7時,我也可以看到錯誤信息。 – Yevgeniy