ViewExpiredException shown in java.lang.Throwable error-page in web.xml

后端 未结 2 544
有刺的猬
有刺的猬 2020-12-05 18:57

I\'m working on a JSF web application in which I need to bring up a \"Session Expired\" page if the view expires, but a general technical error page for all others. The app

2条回答
  •  猫巷女王i
    2020-12-05 19:46

    As mentioned by BylusC, deployment descriptor must not contain any error-page handler that will catch ViewExpiredException (wrapped inside ServletException) instead of the correct one - error-page for ViewExpiredException.

    Do not forget to verify that server's deployment descriptor (e.g. TomEE/conf/web.xml) does not contain java.lang.Throwable or java.lang.Exception error-page definitions. Because these two web.xml are basically merged.

    Yes - application's web.xml has precedence over server's web.xml, but if application's web.xml contains

    • error-page for 500 (/error.xhtml)

    and server's web.xml for

    • 500 (/500.html) and for
    • Throwable (/bigerror.html)

    then application context will contain merge of those two:

    • 500 (/error.xhtml)
    • Throwable (/bigerror.html)

    and ViewExpiredExcpetion error handling will not work correctly.

提交回复
热议问题