出现错误 java.io.NotSerializedException: org.apache.catalina.session.StandardSessionFacade

发布于 2024-12-20 12:44:47 字数 216 浏览 2 评论 0原文

我收到错误

java.io.NotSerializedException:org.apache.catalina.session.StandardSessionFacade

我该如何解决此错误?我在 viewScope 中使用 ManagedBeans。还使用过滤器创建会话。是什么原因导致这个异常发生呢?

谢谢

I am getting error

java.io.NotSerializableException: org.apache.catalina.session.StandardSessionFacade

How can i resolve this error? I am using managedBeans in viewScope. Also creating a session using filter. What causing this exception happening?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

网名女生简单气质 2024-12-27 12:44:47

您已引用 HttpSession 作为某些 JSF 托管 bean 类的属性。这是一个极其糟糕的设计。删除它并更改您的方法以仅从线程本地范围内的 FacesContext 获取它。但毕竟,这仍然是一种味道,在正确设计的 JSF 托管 bean 类中,您应该有任何一行 import javax.servlet...。如何正确解决此问题取决于具体的功能要求,而您的问题根本不清楚这一点。我的第一个猜测是,您实际上需要一个会话范围的托管 bean,它又由 @ManagedProperty 注入。

You have referenced a HttpSession as a property of some JSF managed bean class. This is an extremely bad design. Remove it and change your approach to just get it from the FacesContext in the thread local scope. But after all, this is still a smell, in properly designed JSF managed bean classes you should have not have any single line of import javax.servlet.... How to fix this properly depends on the concrete functional requirement which is not clear from your question at all. My first guess would be that you actually need a session scoped managed bean which is in turn injected by @ManagedProperty.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文