- Tomcat/Spring/REST/Faces app migrated from Mojarra 2.3.13 to Mojarra 4.0.11
- have
FacesServlet mapped at virtual path, e.g. *.faces
- have a Faces page as (general)
<error-page> at virtual path, e.g. /error.faces
- have another servlet running in same app, e.g. Jakarta REST at
/api/* or even (Spring) WebSocket handler at /
- have it throw an exception and invoke ERROR dispatcher
- ERROR dispatcher invokes
FacesServlet, because error page is a Faces page
- Mojarra's
MultiViewHandler#derivePhysicalViewId attempts to figure out the mapping used by FacesServlet
- expects it to be
*.faces, but it's actually /api/* or /, so it cannot find /error.xhtml anymore
- error page rendering completely fails
Appears to be regression introduced by the change of the mapping inspection to utilize the in Servlet 4 introduced HttpServletRequest#getHttpServletMapping as per 45848de
Work around: add *.xhtml mapping to FacesServlet in web.xml and configure error page on /error.xhtml instead.