Reputation: 1
I'm trying to run a flow (Grails 2.3.11, Spring Web Flow 2.0.8.1, JDK 1.7.0_21, OS X 10.9.4).
The first time I fire up the application (by typing "grails run-app" on the command line), I can get to the first page of the flow, and the flow seems to work normally.
However, the next time I try to execute the flow, I get the error below (from the console). This happens even when I delete my cookies and restart the application. If I leave it for a few days and come back to it, it seems to work again (the first time only).
I found a thread from six years ago, but I am not calling flow.clear() like the original poster was. My flow code is below.
Does anyone have any insights on this?
Error:
[ERROR] 27 Jul 2014 21:54:14,086 org.springframework.webflow.engine.impl.FlowExecutionImpl FlowExecutionListener threw exception
java.lang.NullPointerException
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:191)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
[ERROR] 27 Jul 2014 21:54:14,096 org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver IllegalArgumentException occurred when processing request: [GET] /inscriba/author/createAuthor - parameters:
execution: e1s2
Session must not be null. Stacktrace follows:
org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'headshot' of flow 'author/createAuthor'
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:191)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.IllegalArgumentException: Session must not be null
... 5 more
Code:
def createAuthorFlow = {
log.debug("createAuthorFlow: I am here: ")
create {
log.debug("create: I am here")
on("next") {
log.debug("create.next: I am here")
flow.author = new Author(params)
!flow.author.validate() ? error() : success()
flow.author.save()
}.to "headshot"
}
headshot {
on("next") {
log.debug("headshot.next: I am here")
}.to "summary"
}
summary()
}
Upvotes: 0
Views: 696
Reputation: 41
I believe the problem is that you have to use Serializable objects in order to put them into the flow scope. My guess is that the Author object doesn't implement Serializable.
The Grails web-flow documentation mentions this, but just says that an "exception" will be thrown. It took me quite a while to figure out what was going on - hope this helps.
Upvotes: 4