未找到异常和过渡的全球过渡

时间:2014-09-26 05:23:27

标签: spring spring-webflow

我有3个弹簧网络流 - flow1,flow2,flow3。 flow2和flow 3分配了父流量1,如下所示:

<flow xmlns="http://www.springframework.org/schema/webflow"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
  parent="flow1">

在flow1中,我有一个全局转换和一个结束状态:

<end-state id="flowInterrupted" view="flowInterruptedPage"/>

<global-transitions>
    <transition on-exception="com.core.exceptions.policy.InvalidPolicyContactException" to="flowInterrupted">
        <evaluate expression="webFlowService.clearCurrentInterruptCause()"/>
    </transition>
</global-transitions>

在我的应用程序的某个时刻,在flow2中,子流flow3被称为

<subflow-state id="stateInFlow2WhereSubFlow3IsDefined" subflow="flow3">

</subflow-state>

,在flow3中,抛出InvalidPolicyContactException。它在flow1中正确找到(因为它是clearCurrentInterruptCause()的get),但后来抛出异常,在flow2中找不到flowInterrupted转换 - 这是真的,导致它在flow1中(定义了全局转换)。这是一个例外:

org.springframework.webflow.engine.NoMatchingTransitionException: No      transition found on occurence of event 'flowInterrupted'  in state 'stateInFlow2WhereSubFlow3IsDefined' of flow 'flow2' -- valid transitional criteria are array<TransitionCriteria>[exit, contactSelected] -- likely programmer error, check the set of TransitionCriteria for this state at org.springframework.webflow.engine.TransitionableState.getRequiredTransition(TransitionableState.java:93) at org.springframework.webflow.engine.TransitionableState.handleEvent(TransitionableState.java:119)
at org.springframework.webflow.engine.SubflowState.handleEvent(SubflowState.java:116)
at org.springframework.webflow.engine.Flow.handleEvent(Flow.java:555)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.handleEvent(FlowExecutionImpl.java:388)
at org.springframework.webflow.engine.impl.RequestControlContextImpl.handleEvent(RequestControlContextImpl.java:210)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.endActiveFlowSession(FlowExecutionImpl.java:412)
at org.springframework.webflow.engine.impl.RequestControlContextImpl.endActiveFlowSession(RequestControlContextImpl.java:238)

当我更改结束状态时id =&#34; flowInterrupted&#34;查看状态它工作正常。当它从其他流程调用时,将flow1作为父级,它也可以正常工作。当我从flow3中删除parent = flow1时,我不会在全局转换中捕获exceptin。唯一的问题是,当从子流引发异常时。

任何帮助都会受到赞赏 - 我当然可以将flowInterrupted状态放在flow2中并解决问题,但我想了解,为什么会发生这种情况

感谢。

1 个答案:

答案 0 :(得分:-1)

添加 <transition on="flowInterrupted" to="flowInterrupted"/> 在你的全球转型中