spring-mvc - 为什么当 Spring WebFlow 启动时我会收到 SnapshotNotFoundException?

标签 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 安全
  • Spring MVC
  • Spring 数据
  • JPA 2.0,使用/通过自定义 JpaFlowExecutionListener

我的 JpaFlowExecutionListener 的唯一自定义部分是我将 EntityManager 从范围中分离出来的部分,以便它可以序列化流 - 我将其作为数据库支持的流持久性设置。流可以保存到数据库或从数据库读取。但我无法让它渲染第一个 View 。

据我所知,下面是崩溃之前所经历的步骤:

  1. FlowExecutorImpl 代码调用 launchExecution()。
  2. 持久对话已创建。
  3. PersistentConversation 线程已锁定
  4. 将 PersistentConversation 放入executionRepository 和 PersistentConversationHolder 的对话的 ThreadLocal 映射中。 (保留事件线程的对话列表)
  5. 解锁 - 导致删除 ThreadLocal Map 中的 PersistentConversation
  6. 然后调用 FlowExecutorImpl createPausedResult(flowExecution)
  7. 最终会调用 FlowExecutorImplresumeExecution()。
  8. 使用 FlowID 在 PersistenceConversationHolder 映射中查找 PersistenceConversation,但在这里不再找到 PersistenceConversation。
  9. 从数据库中检索并将数据库对象填充到新的 PersistentConversation 中。
  10. 尝试从快照列表中恢复对话,但该对话已在第 5 步中删除。

对于 PersistenceConversationHolder 请引用此 book here 中的示例。

任何帮助将不胜感激!

最佳答案

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

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

一旦我写了这篇文章,很容易发现缺少一步。

关于spring-mvc - 为什么当 Spring WebFlow 启动时我会收到 SnapshotNotFoundException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19797660/

相关文章:

java - Spring 数据 Autowiring 数据库连接无法通过 JUnit 测试

java - 我可以在不同的 Spring Controller 中使用不同参数的相同映射值吗?

java - Spring Webflow : How to pass a bean from a controller to a flow?(使用输入映射)

spring - 集成 Spring Webflow 2 和 Apache Tiles

grails - Webflow:是否可以在流之间切换?

java - jirutka/rsql-parser 和 QueryDSL

java - 如果无法传递 POST 响应,如何回滚事务

mysql - Spring Data JPA(Hibernate)未将列创建为自动增量

mongodb - 在 Mongobee 迁移中使用存储库

java - 可以替代 if 语句的设计模式