为什么我在Spring WebFlow启动时遇到SnapshotNotFoundException?

时间:2013-11-05 19:52:36

标签: spring-mvc spring-webflow spring-data

好的我正在做的就是试图进入我的第一页。我收到以下例外:

org.springframework.webflow.execution.repository.snapshot.SnapshotNotFoundException: 
No flow execution snapshot could be found with id '1'; perhaps the snapshot has been removed? 

我使用以下内容:

  • Spring Webflow 2.3(带有持久性上下文标志)
  • Spring Security
  • Spring MVC
  • 弹簧数据
  • JPA 2.0,带/ via自定义JpaFlowExecutionListener

我的JpaFlowExecutionListener的唯一自定义部分是我将EntityManager从作用域中分离的部分,因此它可以序列化流 - 我将其作为数据库支持的流程持久性设置。从db ok保存/读取流。但我不能让它渲染第一个视图。

从我在这里可以看出的是它在下面崩溃之前所经历的步骤:

  1. FlowExecutorImpl代码调用launchExecution()。
  2. 创建了PersistentConversation。
  3. PersistentConversation线程已锁定
  4. PersistentConversation放入executionRepository和PersistentConversationHolder的ThreadLocal会话映射。 (保持活动线程的对话列表)
  5. 解锁 - 导致删除ThreadLocal Map中的PersistentConversation
  6. 然后调用FlowExecutorImpl createPausedResult(flowExecution)
  7. 最终调用FlowExecutorImpl resumeExecution()。
  8. 使用FlowID在PersistenceConversationHolder地图中查找PersistentConversation,但不再在此处找到PersistentConversation。
  9. 从数据库中检索并将db对象填充到新的PersistentConversation中。
  10. 尝试从其快照列表中恢复对话,但在步骤5中已将其删除。
  11. 对于PersistenceConversationHolder,请参考此book here中的示例。

    任何帮助都会非常感激!

1 个答案:

答案 0 :(得分:2)

如果有人也像我一样错过了这个......

在上面的步骤#5中,当线程解锁时,您需要更新保存/更新PersistentConversation到db,此副本将包含所有快照信息。

一旦我写完这篇文章就很容易看出有一个缺失的步骤。