本文介绍了反序列化会话数据时出现InvalidClassException错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是调用代码:
Object attribute = session.getAttribute(name, scope);
这会引发以下错误:
Could not deserialize session data.
java.io.InvalidClassException: org.apache.commons.lang.time.FastDateFormat; local class incompatible: stream classdesc serialVersionUID = 1, local class serialVersionUID = -7186497712641044641
环境是Weblogic。 Web应用程序是一个spring portlet。我正在尝试了解如何解决此问题。
The environment is Weblogic. The Web application is a spring portlet. I'm trying to understand how to fix this issue.
推荐答案
必须将commons-lang添加到首选应用程序包 用于修复此问题的weblogic.xml部分。
Had to add the commons-lang to the "preferred application packages" section of weblogic.xml to get this fixed.
<container-descriptor>
<prefer-application-packages>
<package-name>org.apache.commons.lang.*</package-name>
</prefer-application-packages>
<optimistic-serialization>true</optimistic-serialization>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>
这篇关于反序列化会话数据时出现InvalidClassException错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!