在Spring WebFlow中获取SnapshotNotFoundException

时间:2018-06-07 07:27:33

标签: java spring spring-webflow

我在生产环境中遇到org.springframework.webflow.execution.repository.snapshot.SnapshotNotFound异常,但是我无法在开发环境中复制此问题。对此有任何帮助表示赞赏

网址: - /path?execution=e5s6

我也定义了最大快照

<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry" >
   <webflow:flow-execution-listeners>
     <webflow:listener ref="loggingListener"/>
   </webflow:flow-execution-listeners>
    <webflow:flow-execution-repository max-executions="5" max-execution-snapshots="50" />
</webflow:flow-executor>

此处有错误堆栈跟踪

    org.springframework.webflow.execution.repository.snapshot.SnapshotNotFoundException: No flow execution snapshot could be found with id '7'; 
    perhaps the snapshot has been removed? at 
org.springframework.webflow.execution.repository.impl.SimpleFlowExecutionSnapshotGroup.getSnapshot(SimpleFlowExecutionSnapshotGroup.java:73) at 
    org.springframework.webflow.execution.repository.impl.DefaultFlowExecutionRepository.getFlowExecution(DefaultFlowExecutionRepository.java:111) at 
    org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:168) at 
    org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:228) at 
    org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174) at

1 个答案:

答案 0 :(得分:0)

我想我找到了问题,Spring Webflow每次都会增加快照。 url?execution = e1s1,e1s2 ..... e1s10

现在在URL中如果我们手动输入url?execution = e1s9没有错误,但是如果我们尝试 url?execution = e1s3 它会给出异常。我想spring webflow在内存中保留了很少的快照

错误堆栈

Caused by: org.springframework.webflow.execution.repository.FlowExecutionRestorationFailureException: A problem occurred restoring the flow execution with key 'e7s5'
    at org.springframework.webflow.execution.repository.impl.DefaultFlowExecutionRepository.getFlowExecution(DefaultFlowExecutionRepository.java:113)
    at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:168)
    at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:228)
    at org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
    at com.czen.app.framework.CZenDispatcherServlet.doDispatch(CZenDispatcherServlet.java:102)
    ... 73 more  Caused by: org.springframework.webflow.execution.repository.snapshot.SnapshotNotFoundException: No flow execution snapshot could be found with id '5'; perhaps the snapshot has been removed?
    at org.springframework.webflow.execution.repository.impl.SimpleFlowExecutionSnapshotGroup.getSnapshot(SimpleFlowExecutionSnapshotGroup.java:73)
    at org.springframework.webflow.execution.repository.impl.DefaultFlowExecutionRepository.getFlowExecution(DefaultFlowExecutionRepository.java:111)
    ... 79 more