WildFly 10 登录后页面空白

Blank page after login on WildFly 10

我已经在 Wildfly 10 上部署了一个应用程序,该应用程序在 GlassFish 上运行正常,但是当我尝试登录时出现空白页面 /<context_path>/j_security_check。 我看过一些建议包含缓存控制请求 headers 的帖子,但它并没有解决问题。 日志没有显示任何类型的错误或相关信息,我真的不知道接下来要尝试什么。 有没有人遇到过类似的问题?

编辑 1 身份验证工作正常。如果之后我尝试访问受保护的资源,我可以这样做。只是没有触发登录后的重定向

编辑 2 Request/Response 转储:

----------------------------REQUEST---------------------------
               URI=/ecc
characterEncoding=null
     contentLength=-1
       contentType=null
            cookie=EPMSID=sfTmDLw92HjAhwfY7HUei5fzlUbwKjxUg3EhyTMk.d014349
            header=Accept=text/html, application/xhtml+xml, */*
            header=Connection=Keep-Alive
            header=Accept-Language=pt-PT
            header=Accept-Encoding=gzip, deflate
            header=Cookie=EPMSID=sfTmDLw92HjAhwfY7HUei5fzlUbwKjxUg3EhyTMk.d014349
            header=User-Agent=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
            header=Host=localhost:8443
            locale=[pt_PT]
            method=GET
          protocol=HTTP/1.1
       queryString=
        remoteAddr=/127.0.0.1:62990
        remoteHost=sibshare
            scheme=https
              host=localhost:8443
        serverPort=8443
--------------------------RESPONSE--------------------------
     contentLength=0
       contentType=null
            header=Connection=keep-alive
            header=X-Powered-By=Undertow/1
            header=Server=WildFly/10
            header=Location=https://localhost:8443/ecc/
            header=Content-Length=0
            header=Date=Mon, 09 May 2016 08:18:33 GMT
            status=302
==============================================================
2016-05-09 09:18:33,890 INFO  [stdout] (default task-5) [DEBUG] ecc_src - NoCacheFilter:Initializing filter
2016-05-09 09:18:33,902 INFO  [io.undertow.request.dump] (default task-5)
----------------------------REQUEST---------------------------
               URI=/ecc/
characterEncoding=null
     contentLength=-1
       contentType=null
            cookie=EPMSID=sfTmDLw92HjAhwfY7HUei5fzlUbwKjxUg3EhyTMk.d014349
            header=Accept=text/html, application/xhtml+xml, */*
            header=Connection=Keep-Alive
            header=Accept-Language=pt-PT
            header=Accept-Encoding=gzip, deflate
            header=Cookie=EPMSID=sfTmDLw92HjAhwfY7HUei5fzlUbwKjxUg3EhyTMk.d014349
            header=User-Agent=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
            header=Host=localhost:8443
            locale=[pt_PT]
            method=GET
          protocol=HTTP/1.1
       queryString=
        remoteAddr=/127.0.0.1:62989
        remoteHost=sibshare
            scheme=https
              host=localhost:8443
        serverPort=8443
--------------------------RESPONSE--------------------------
     contentLength=239
       contentType=text/html
            header=Expires=Thu, 01 Jan 1970 00:00:00 GMT
            header=Cache-Control=no-cache, no-store, must-revalidate
            header=X-Powered-By=Undertow/1
            header=Server=WildFly/10
            header=Pragma=no-cache
            header=Accept-Ranges=bytes
            header=Date=Mon, 09 May 2016 08:18:33 GMT
            header=Connection=keep-alive
            header=ETag=W/"239-1462554016000"
            header=Last-Modified=Fri, 06 May 2016 17:00:16 GMT
            header=Content-Type=text/html
            header=Content-Length=239
            status=200
==============================================================
2016-05-09 09:18:34,112 INFO  [io.undertow.request.dump] (default task-6)
----------------------------REQUEST---------------------------
               URI=/ecc/secure/home.jsf
characterEncoding=null
     contentLength=-1
       contentType=null
            cookie=EPMSID=sfTmDLw92HjAhwfY7HUei5fzlUbwKjxUg3EhyTMk.d014349
            header=Accept=text/html, application/xhtml+xml, */*
            header=Connection=Keep-Alive
            header=Accept-Language=pt-PT
            header=Accept-Encoding=gzip, deflate
            header=Cookie=EPMSID=sfTmDLw92HjAhwfY7HUei5fzlUbwKjxUg3EhyTMk.d014349
            header=User-Agent=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
            header=Host=localhost:8443
            locale=[pt_PT]
            method=GET
          protocol=HTTP/1.1
       queryString=
        remoteAddr=sibshare/127.0.0.1:62990
        remoteHost=sibshare
            scheme=https
              host=localhost:8443
        serverPort=8443
--------------------------RESPONSE--------------------------
     contentLength=2897
       contentType=text/html;charset=UTF-8
            cookie=EPMSID=KcblRlqogTv4hCuVtjeL27onM3Nbp04k--DDZfnt.d014349; domain=null; path=/ecc
            header=Expires=0
            header=Expires=0
            header=Cache-Control=no-cache, no-store, must-revalidate
            header=Cache-Control=no-cache, no-store, must-revalidate
            header=X-Powered-By=Undertow/1
            header=Set-Cookie=EPMSID=KcblRlqogTv4hCuVtjeL27onM3Nbp04k--DDZfnt.d014349; path=/ecc; secure; HttpOnly
            header=Server=WildFly/10
            header=Pragma=no-cache
            header=Pragma=no-cache
            header=Date=Mon, 09 May 2016 08:18:34 GMT
            header=Connection=keep-alive
            header=Content-Type=text/html;charset=UTF-8
            header=Content-Length=2897
            status=200
==============================================================
2016-05-09 09:18:44,841 INFO  [io.undertow.request.dump] (default task-13)
----------------------------REQUEST---------------------------
               URI=/ecc/j_security_check
characterEncoding=null
     contentLength=68
       contentType=[application/x-www-form-urlencoded]
            cookie=EPMSID=KcblRlqogTv4hCuVtjeL27onM3Nbp04k--DDZfnt.d014349
            header=Accept=text/html, application/xhtml+xml, */*
            header=Accept-Language=pt-PT
            header=Cache-Control=no-cache
            header=Accept-Encoding=gzip, deflate
            header=User-Agent=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
            header=Connection=Keep-Alive
            header=Content-Type=application/x-www-form-urlencoded
            header=Content-Length=68
            header=Cookie=EPMSID=KcblRlqogTv4hCuVtjeL27onM3Nbp04k--DDZfnt.d014349
            header=Referer=https://localhost:8443/ecc/secure/home.jsf
            header=Host=localhost:8443
            locale=[pt_PT]
           method=POST
          protocol=HTTP/1.1
       queryString=
        remoteAddr=sibshare/127.0.0.1:62993
        remoteHost=sibshare
            scheme=https
              host=localhost:8443
        serverPort=8443
--------------------------RESPONSE--------------------------
     contentLength=0
       contentType=null
            cookie=EPMSID=JtIoopj1u-p_Ko95XwYi45HqkdzNBVRxSklVFQEL.d014349; domain=null; path=/ecc
            header=Expires=0
            header=Cache-Control=no-cache, no-store, must-revalidate
            header=X-Powered-By=Undertow/1
            header=Set-Cookie=EPMSID=JtIoopj1u-p_Ko95XwYi45HqkdzNBVRxSklVFQEL.d014349; path=/ecc; secure; HttpOnly
            header=Server=WildFly/10
            header=Pragma=no-cache
            header=Date=Mon, 09 May 2016 08:18:44 GMT
            header=Connection=keep-alive
            header=Content-Length=0
            status=200
==============================================================

我终于弄明白问题出在哪里了。 在我的登录页面中,我配置了以下用于使活动会话无效的侦听器:

<f:metadata>
<f:event  type="preRenderView" listener="#{manager.invalidateActiveSession}" />
</f:metadata>

此侦听器只是使会话无效(如果存在):

HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);

if (session != null ) {
    synchronized( session ) {
        session.invalidate();
    }
}

这就是导致奇怪行为的原因。同样的代码在 GlassFish 上运行良好。 我已将代码更改为另外验证 Principal 是否也不为空。