2017-05-08 87 views
0

我看不到捕捉表達式策略的異常上下文中的causeMatches方法。我在運行時遇到錯誤。 我在哪裏可以找到異常上下文對象中的可用方法?我無法找到一個API文檔中 - http://www.mulesoft.org/docs/site/3.8.3/apidocs/在選擇異常策略中捕捉異常策略

ERROR 2017-05-08 20:20:05,348 [[american-flights-ws].HTTP_Listener_Configuration.worker.01] org.mule.exception.DefaultSystemExceptionStrategy: Caught exception 
in Exception Strategy: Execution of the expression "exception.causeMatches('com.mulesoft.weave.*')" failed. 
org.mule.api.expression.ExpressionRuntimeException: Execution of the expression "exception.causeMatches('com.mulesoft.weave.*')" failed. 
    at org.mule.el.mvel.MVELExpressionLanguage.evaluateInternal(MVELExpressionLanguage.java:232) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.el.mvel.MVELExpressionLanguage.evaluate(MVELExpressionLanguage.java:163) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.el.mvel.MVELExpressionLanguage.evaluate(MVELExpressionLanguage.java:142) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:216) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.expression.DefaultExpressionManager.evaluateBoolean(DefaultExpressionManager.java:417) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.expression.DefaultExpressionManager.evaluateBoolean(DefaultExpressionManager.java:674) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.exception.TemplateMessagingExceptionStrategy.accept(TemplateMessagingExceptionStrategy.java:191) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.exception.ChoiceMessagingExceptionStrategy.handleException(ChoiceMessagingExceptionStrategy.java:55) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.execution.AsyncResponseFlowProcessingPhase$3$1.execute(AsyncResponseFlowProcessingPhase.java:131) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.execution.AsyncResponseFlowProcessingPhase.executeCallback(AsyncResponseFlowProcessingPhase.java:144) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.execution.AsyncResponseFlowProcessingPhase.access$000(AsyncResponseFlowProcessingPhase.java:35) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.execution.AsyncResponseFlowProcessingPhase$3.responseSentWithFailure(AsyncResponseFlowProcessingPhase.java:125) ~[mule-core-3.8.3.jar:3.8.3] 
    at org.mule.module.http.internal.listener.HttpMessageProcessorTemplate.doBuildResponse(HttpMessageProcessorTemplate.java:129) ~[mule-module-http-3.8.3.jar:3.8. 
3] 
+0

請發佈您的XML配置? – star

回答

0

沒有你的XML,它只是猜測失敗的原因。但是,這是一個工作異常策略:

<choice-exception-strategy doc:name="Choice_Exception_Strategy"> 
     <catch-exception-strategy when="exception.causeMatches('com.mulesoft.weave.*')" doc:name="Catch Weave"> 
      <logger message="#[message]" level="INFO" doc:name="Logger"/> 
     </catch-exception-strategy> 
     <catch-exception-strategy when="exception.causeMatches('java.lang.Exception')" doc:name="Catch other"> 
      <logger message="#[message]" level="INFO" doc:name="Logger"/> 
     </catch-exception-strategy> 
    </choice-exception-strategy> 

如有疑問,請閱讀文檔:https://docs.mulesoft.com/mule-user-guide/v/3.8/catch-exception-strategy

0

這裏是例外的選擇策略。沒有編譯錯誤,但語法看起來有點不同。

<choice-exception-strategy name="ImplementationChoice_Exception_Strategy"> 
    <catch-exception-strategy 
     when="#[exception.causeMatches('com.mule.weave.*') || exception.message=='Payload is empty.']" 
     doc:name="No flights DW exception"> 
     <set-payload value="No flights too #[flowVars.code + '\n' + exception]" 
      doc:name="Set Payload" /> 
     <set-property propertyName="http.status" value="400" 
      doc:name="Property" /> 
     <logger level="INFO" doc:name="Logger" /> 
    </catch-exception-strategy> 
    <catch-exception-strategy doc:name="Catch Exception Strategy"> 
     <set-payload value="data is not available, try later #['\n' + exception]" 
      doc:name="Set Payload" /> 
     <set-property propertyName="http.status" value="500" 
      doc:name="Property" /> 
     <logger level="INFO" doc:name="Logger" /> 
    </catch-exception-strategy> 
</choice-exception-strategy>