Jfinal4.4,undertow1.9 系统热部署,session无法转换

使用Jfinal4.4,undertow1.9时,修改代码,系统热部署,报如下错误。

应该是session中的对象重新加载错误。

Info: jfinal-undertow 1.9, undertow 2.0.25.Final, jvm 1.8.0_221

错误信息:

2019-09-14 22:22:12 [sipl_health] UT015009: Failed to persist session attribute smarthealth_userbean with value com.sipl.user.UserBean@5bd88247 for session oy9UpkLOlMIGbhDq52ig5WQoehAoFb9h6dteRT8v
java.io.NotSerializableException: com.sipl.user.UserBean
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at com.jfinal.server.undertow.session.HotSwapSessionPersistenceManager.persistSessions(HotSwapSessionPersistenceManager.java:50)
at io.undertow.servlet.handlers.SessionRestoringHandler.stop(SessionRestoringHandler.java:108)
at io.undertow.servlet.core.DeploymentManagerImpl$3.call(DeploymentManagerImpl.java:614)
at io.undertow.servlet.core.DeploymentManagerImpl$3.call(DeploymentManagerImpl.java:609)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.core.DeploymentManagerImpl.stop(DeploymentManagerImpl.java:623)
at com.jfinal.server.undertow.UndertowServer.doStop(UndertowServer.java:405)
at com.jfinal.server.undertow.UndertowServer.restart(UndertowServer.java:423)
at com.jfinal.server.undertow.hotswap.HotSwapWatcher.doRun(HotSwapWatcher.java:133)
at com.jfinal.server.undertow.hotswap.HotSwapWatcher.run(HotSwapWatcher.java:91)
2


评论区

JFinal

2019-09-15 10:16

UserBean 需要实现 java.io.Serializable 接口

public UserBean implements Serializable {
...
}

tubage

2019-09-15 20:16

好的。