Dguti
Dguti

Reputation: 81

Why am I getting a SnapshotNotFoundException when Spring WebFlow is starting?

Ok all I am doing is trying to get to my 1st page. And I receive the following exception:

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

I am using the following:

The only custom part of my JpaFlowExecutionListener is the part where I detach the EntityManager from the scope so it can serialize the flow - I have this as a database backed flow peristence setup. The flows are saved/read from/to the db ok. But I can't get it to render the first view.

From what I can tell here are the steps it goes thru prior to crashing below:

  1. FlowExecutorImpl code calls launchExecution().
  2. PersistentConversation is created.
  3. PersistentConversation thread locked
  4. PersistentConversation put into executionRepository and in PersistentConversationHolder's ThreadLocal Map of conversations. (keeps active thread's list of Conversations)
  5. unlocks - causes a delete of the PersistentConversation in ThreadLocal Map
  6. Then calls FlowExecutorImpl createPausedResult(flowExecution)
  7. Which eventually calls FlowExecutorImpl resumeExecution().
  8. Looks up PersistentConversation in PersistenceConversationHolder map using FlowID, but no longer finds PersistentConversation here.
  9. Retrieves from the database and stuffs db object into a new PersistentConversation.
  10. Attempts to resume Conversation from it's snapshot list but it was deleted in step 5.

For the PersistenceConversationHolder please reference example in this book here.

Any help would be so appreciated!

Upvotes: 2

Views: 1686

Answers (1)

Dguti
Dguti

Reputation: 81

In case someone also misses this as I did...

At step #5 above when the Thread is unlocked, you need to update the save/update the PersistentConversation to the db, this copy will contain all the snapshot info.

Once I wrote this it was easy to see that there was a missing step.

Upvotes: 2

Related Questions