IceFaces 会话过期导致异常

发布于 2024-10-31 05:25:35 字数 1240 浏览 1 评论 0原文

我的 IceFaces 应用程序在会话到期时崩溃。它没有显示“用户会话已过期”或“网络连接中断”消息。

我的猜测是再次加载同一页面,并且由于后备 bean 代码找不到会话变量,因此它会抛出以下异常:

exception
javax.servlet.ServletException: java.lang.Exception: javax.faces.FacesException: Problem in renderResponse: /main-template.jspx: User session has expired or it was invalidated.

root cause
java.lang.Exception: javax.faces.FacesException: Problem in renderResponse: /main-template.jspx: User session has expired or it was invalidated.

root cause
javax.faces.FacesException: Problem in renderResponse: /main-template.jspx: User session has expired or it was invalidated.

root cause
javax.el.ELException: /main-template.jspx: User session has expired or it was invalidated.

root cause
com.icesoft.faces.webapp.http.core.SessionExpiredException: User session has expired or it was invalidated.

root cause
java.lang.IllegalStateException: PWC2778: getAttribute: Session already invalidated

异步更新已开启,并且 jsp 页面具有 > 组件。

关于如何阻止这种情况发生有什么想法吗?

注意:我做了很多奇特的事情,比如在会话超时时重定向,以及显示 java.lang.Throwable 的错误页面,但我已经将其全部注释掉了 - 运气不好。当重定向和错误处理都打开时,应用程序第一次会显示错误页面,然后在一段时间后重定向到“会话到期”页面。

谢谢

My IceFaces application crashes on session expiry. It's not showing the "User Session Expired" or "Network Connection Interrupted" message.

My guess is the same page is loaded again, and since the backing bean code cannot find the session variables, it throws the following exception:

exception
javax.servlet.ServletException: java.lang.Exception: javax.faces.FacesException: Problem in renderResponse: /main-template.jspx: User session has expired or it was invalidated.

root cause
java.lang.Exception: javax.faces.FacesException: Problem in renderResponse: /main-template.jspx: User session has expired or it was invalidated.

root cause
javax.faces.FacesException: Problem in renderResponse: /main-template.jspx: User session has expired or it was invalidated.

root cause
javax.el.ELException: /main-template.jspx: User session has expired or it was invalidated.

root cause
com.icesoft.faces.webapp.http.core.SessionExpiredException: User session has expired or it was invalidated.

root cause
java.lang.IllegalStateException: PWC2778: getAttribute: Session already invalidated

Asynchronous updates are on, and the jsp page has the <ice:outputConnectionStatus /> component.

Any ideas on how to stop this from happening?

Note: I was doing a lot of fancy stuff, like redirecting on session timeout, and displaying error pages for java.lang.Throwable, but I've commented it all out - without luck. When both redirection and error-handling were switched on, on the first time the application would show the error page, then after a while redirect to "session-expiry" page.

Thanks

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

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

发布评论

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

评论(1

荭秂 2024-11-07 05:25:35

我对 RichFaces 也遇到了同样的问题,这个答案救了我:

jsf 登录超时

很多我建议您查看此博客的转身和奇怪的事情:

http://balusc.blogspot.com/

这是我当前使用的代码:

package com.spectotechnologies.jsf.viewhandler;

import com.sun.facelets.FaceletViewHandler;
import java.io.IOException;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;

/**
 * Source : https://stackoverflow.com/questions/231191/jsf-login-times-out
 *
 * This ViewHandler is used to remove the ViewExpiredException problem at login
 * after the session is expired.
 *
 * @author Alexandre Lavoie
 */
public class AutoRegeneratorViewHandler extends FaceletViewHandler
{
    public AutoRegeneratorViewHandler(ViewHandler p_oViewHandler)
    {
        super(p_oViewHandler);
    }

    @Override
    public UIViewRoot restoreView(FacesContext p_oContext, String p_sViewID)
    {
        UIViewRoot oViewRoot = super.restoreView(p_oContext,p_sViewID);

        if(oViewRoot == null)
        {
            // Work around Facelet issue
            initialize(p_oContext);

            oViewRoot = super.createView(p_oContext,p_sViewID);
            p_oContext.setViewRoot(oViewRoot);

            try
            {
                buildView(p_oContext,oViewRoot);
            }
            catch(IOException e)
            {
                e.printStackTrace();
            }
        }

        return oViewRoot;
    }
}

您还必须将其放入 faces-config.xml 中:

<application>
    <view-handler>com.spectotechnologies.jsf.viewhandler.AutoRegeneratorViewHandler</view-handler>
</application>

I had the same problem with RichFaces and this answer saved me :

jsf login times out

For a lot of turn around and stranges things I recommend to see this blog :

http://balusc.blogspot.com/

Here is the code I'm currently using :

package com.spectotechnologies.jsf.viewhandler;

import com.sun.facelets.FaceletViewHandler;
import java.io.IOException;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;

/**
 * Source : https://stackoverflow.com/questions/231191/jsf-login-times-out
 *
 * This ViewHandler is used to remove the ViewExpiredException problem at login
 * after the session is expired.
 *
 * @author Alexandre Lavoie
 */
public class AutoRegeneratorViewHandler extends FaceletViewHandler
{
    public AutoRegeneratorViewHandler(ViewHandler p_oViewHandler)
    {
        super(p_oViewHandler);
    }

    @Override
    public UIViewRoot restoreView(FacesContext p_oContext, String p_sViewID)
    {
        UIViewRoot oViewRoot = super.restoreView(p_oContext,p_sViewID);

        if(oViewRoot == null)
        {
            // Work around Facelet issue
            initialize(p_oContext);

            oViewRoot = super.createView(p_oContext,p_sViewID);
            p_oContext.setViewRoot(oViewRoot);

            try
            {
                buildView(p_oContext,oViewRoot);
            }
            catch(IOException e)
            {
                e.printStackTrace();
            }
        }

        return oViewRoot;
    }
}

You also have to put this in faces-config.xml :

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