我没有在捕获的表达式策略的异常上下文中看到方法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 :(得分: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
答案 1 :(得分: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>