【问题标题】:Grails/Spring Web Flow Plugin: Session must not be null errorGrails/Spring Web Flow 插件:会话不能为空错误
【发布时间】:2014-08-23 11:16:44
【问题描述】:

我正在尝试运行流程(Grails 2.3.11、Spring Web Flow 2.0.8.1、JDK 1.7.0_21、OS X 10.9.4)。

第一次启动应用程序时(通过在命令行中输入“grails run-app”),我可以进入流程的第一页,流程似乎工作正常。

但是,下次我尝试执行流程时,我收到以下错误(来自控制台)。即使我删除了我的 cookie 并重新启动应用程序,也会发生这种情况。如果我把它放几天再回来,它似乎又可以工作了(仅限第一次)。

我找到了六年前的 thread,但我没有像原始海报那样调用 flow.clear()。我的流程代码如下。

有人对此有任何见解吗?

错误:

[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

代码:

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()
}

【问题讨论】:

  • 嗨!有关于这个问题的消息吗?

标签: spring grails


【解决方案1】:

我认为问题在于您必须使用 Serializable 对象才能将它们放入流范围。我的猜测是 Author 对象没有实现 Serializable。

Grails web-flow 文档提到了这一点,但只是说会抛出“异常”。我花了很长时间才弄清楚发生了什么 - 希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-19
    • 2010-12-26
    • 1970-01-01
    • 1970-01-01
    • 2012-05-28
    • 1970-01-01
    • 2014-11-26
    相关资源
    最近更新 更多