以下是我试图忽略异常的流程。
<flow name="demoFlow1" doc:name="demoFlow1">
<http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:5050/demo" doc:name="HTTP"/>
<set-payload value="#['sucess']" doc:name="Set Payload"/>
<catch-exception-strategy when="#[!exception.causedBy(org.mule.api.registry.ResolverException)]" doc:name="Catch Exception Strategy">
<logger message="Exception in flow" level="INFO" doc:name="Logger"/>
</catch-exception-strategy>
</flow>
我收到以下错误
org.mule.api.construct.FlowConstructInvalidException: **Flow exception listener contains and exception strategy that doesn't handle all request, Perhaps there's an exception strategy with a when attribute set but it's not part of a catch exception strategy**
at org.mule.construct.AbstractFlowConstruct.validateConstruct(AbstractFlowConstruct.java:286)
at org.mule.construct.AbstractPipeline.validateConstruct(AbstractPipeline.java:227)
at org.mule.construct.AbstractFlowConstruct$1.onTransition(AbstractFlowConstruct.java:108)
at org.mule.construct.AbstractFlowConstruct$1.onTransition(AbstractFlowConstruct.java:103)
at org.mule.lifecycle.AbstractLifecycleManager.invokePhase(AbstractLifecycleManager.java:138)
at org.mule.construct.FlowConstructLifecycleManager.fireInitialisePhase(FlowConstructLifecycleManager.java:78)
at org.mule.construct.AbstractFlowConstruct.initialise(AbstractFlowConstruct.java:102)
你可以在mule 3.4.2版本中帮我解决这个问题吗?
答案 0 :(得分:0)
使用选择异常,然后将该catch异常放入其中。
<flow name="demoFlow1" doc:name="demoFlow1">
<http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:5050/demo" doc:name="HTTP"/>
<set-payload value="#['sucess']" doc:name="Set Payload"/>
<choice-exception-strategy doc:name="Choice Exception Strategy">
<catch-exception-strategy when="#[!exception.causedBy(org.mule.api.registry.ResolverException)]" doc:name="Catch Exception Strategy">
<logger message="Exception in flow" level="INFO" doc:name="Logger"/>
</catch-exception-strategy>
</choice-exception-strategy>
</flow>
不确定是否需要通用捕获异常,但上述工作在3.6。如果是这种情况,请在下面执行此操作(使用通用catch异常 - 不'when'属性)
<flow name="demoFlow1" doc:name="demoFlow1">
<http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:5050/demo" doc:name="HTTP"/>
<set-payload value="#['sucess']" doc:name="Set Payload"/>
<choice-exception-strategy doc:name="Choice Exception Strategy">
<catch-exception-strategy when="#[!exception.causedBy(org.mule.api.registry.ResolverException)]" doc:name="Catch Exception Strategy">
<logger message="Exception in flow" level="INFO" doc:name="Logger"/>
</catch-exception-strategy>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<logger message="Exception in flow" level="INFO" doc:name="Logger"/>
</catch-exception-strategy>
</choice-exception-strategy>
</flow>
答案 1 :(得分:0)
Pbris这个基于异常的表达式(当条件时)
when="#[!exception.causedBy(org.mule.api.registry.ResolverException)]
它必须仅用于您在编写catch-exception-strategy
的选择异常策略中 <catch-exception-strategy when="#[!exception.causedBy(org.mule.api.registry.ResolverException)]" doc:name="Catch Exception Strategy">
<logger message="Exception in flow" level="INFO" doc:name="Logger"/>
</catch-exception-strategy>
这段代码在删除when条件之前不会工作 同样的事情将在选择异常策略中工作,而不删除when条件
从mule esb文档中引用
答案 2 :(得分:0)
我遇到了同样的问题。在Choice异常中使用catch异常,这将起作用