grails webflow notserializableexception

时间:2016-12-20 17:21:35

标签: notserializableexception grails-webflow jsecurity

Grails从1.3.7升级到Grails 2.1.0。 Grails run-app已执行。没有错误。

调用webflow操作会抛出GrailsExceptionResolver错误。 grails webflow对象的状态不可序列化。我已经导航了所有类,以确保所有类都具有'可序列化'。

错误未识别未被序列化的对象,因此无法识别是否应使类字段成为瞬态而被序列化运行时忽略。

Full Stacktrace:
2016-12-20 09:51:25,750 [http-bio-80-exec-1] DEBUG services.RpgService  - ************ 

| Error 2016-12-20 09:51:26,450 [http-bio-80-exec-1] ERROR errors.GrailsExceptionResolver  - NotSerializableException occurred when processing request: [GET] /…/…/order
org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext. Stacktrace follows:
Message: Could not serialize flow execution; make sure all objects stored in flow or flash scope are serializable
   Line | Method
->> 384 | doFilterInternal in org.jsecurity.web.servlet.JsecurityFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|   183 | doFilter         in org.jsecurity.web.servlet.OncePerRequestFilter
|   886 | runTask . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run              in     ''
^   662 | run . . . . . .  in java.lang.Thread
Caused by NotSerializableException: org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext
->> 1164 | writeObject0     in java.io.ObjectOutputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|   1518 | defaultWriteFields in     ''
|   1483 | writeSerialData  in     ''
|   1400 | writeOrdinaryObject in     ''
|   1158 | writeObject0 . . in     ''
|   1518 | defaultWriteFields in     ''
|   1483 | writeSerialData  in     ''
|   1400 | writeOrdinaryObject in     ''
|   1158 | writeObject0 . . in     ''
|   330 | writeObject      in     ''
|   1001 | writeObject . .  in java.util.HashMap
|   940 | invokeWriteObject in java.io.ObjectStreamClass
|   1469 | writeSerialData  in java.io.ObjectOutputStream
|   1400 | writeOrdinaryObject in     ''
|   1158 | writeObject0 . . in     ''
|   1518 | defaultWriteFields in     ''

1 个答案:

答案 0 :(得分:0)

找到了解决方案。 我的控制器服务是调用sessionFactory,它也需要是瞬态的。

代码更改: def sessionFactory =>瞬态sessionFactory。 不需要直接使任何域类变量瞬态。 解决了这个问题。