且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java序列化异常消息

更新时间:2023-02-18 22:44:35

这意味着您已在会话中放置了一个不可序列化的对象,并且您已在服务器停止时启用了会话持久性。

This means you have put an object in the session that is not serializable, and you have enabled session persistence on server stop.

您有多种选择:


  • 使有问题的类实现 Serializable

  • 将其从 sessionDestroyed(..)的会话中删除 HttpSessionListener

  • 如果它是会话中存储的另一个类的成员,请将其设为 transient

  • 只是忽略错误

  • make the class in question implement Serializable
  • remove it from the session on sessionDestroyed(..) of a HttpSessionListener
  • if it is a member of another class stored in the session, make it transient
  • simply ignore the error

你还应该清理tomcat的work目录,这样就不会有先前的序列化会话已经恢复。

You should also clean the "work" directory of tomcat so that no previous serialized session is restored.