Error 404 occurs when accessing pages within web-inf in the production environment, however the error does not occur in the development environment

19 hours ago 3
ARTICLE AD BOX

If you don't see any relevant logging then you're probably looking in the wrong place. What file you should be looking at and whether you should expect to see anything logged at all depends on configuration details that you have not presented, but you should at least see the 404 itself logged in your web server's access and error logs. Tomcat's own log data, where you would expect to find details, is likely to be directed somewhere else.

I presume that you have already verified that /WEB-INF/view/authentication.jsp actually does exist in the webapp as deployed in prod, and that it is accessible to the server (ownership, permissions, other access controls). Since you said "web-inf" in the question text, as opposed to "WEB-INF", I note that paths should generally be considered case-sensitive.

There are other factors that could be involved, such as servlet filters or certain third-party frameworks, but it is reasonably likely that the <%@include ...%> scriptlets in your JSP are playing a part here. Since their file attributes do not start with /, they will be resolved relative to the application path in which the host JSP resides (/WEB-INF/view), so

<%@include file="WEB-INF/jspf/header.jspf" %>

will look for application path /WEB-INF/view/WEB-INF/jspf/header.jspf, which probably is not what you intended. It is possible that failure to find those is resulting in a 404 error instead of a 500 error, especially given that there is a secondary error involving failing to find an ErrorDocument to serve notice of the main error. You almost certainly want

<%@include file="/WEB-INF/jspf/header.jspf" %>

instead. Similar for the footer.

As for why you don't see an error in the dev environment, my first guess would be that you actually do have /WEB-INF/view/WEB-INF/jspf/header.jspf and .../footer.jspf there, whether intentionally or by accident. There may be other explanations.

Read Entire Article