My setting: Apache 2.2 + Tomcat 6.0 @ Windows 2008 R2 64bit
tomcat\conf\web.xml:
<error-page>
<error-code>404</error-code>
<location>/404.jsp</location>
</error-page>
apache\conf\extra\httpd-ssl.conf:
JkMount /foo/* worker1
JkMount /404.jsp worker1
When I open https://...../404.jsp my custom error page is displayed. But when I open https://...../foo/nonexisting.html an empty page is displayed.
If I remove the <error-page>...</error-page>
code from web.xml and open https://...../foo/nonexisting.html then tomcats own 404 is displayed.
Any hints?
The default Tomcat error page exposes the Tomcat version that SDM is using. After the above changes, when the SDM URL is accessed via http://<SD server hostname>:<port#>/abc, a screen similar to the following will appear that does not have the Tomcat version listed.
Custom error pages enable you to customize the pages that display when an error occurs. This makes your website appear more professional and also prevents visitors from leaving your site. If a visitor sees a generic error page, they are likely to leave your site.
To create a JSP error page, we need to set page directive attribute isErrorPage value to true, then we can access exception jsp implicit object in the JSP and use it to send customized error message to the client.
The Jkmount should have the context as parameter, ex:
JkMount /mycontext/* worker1
then the pages are accessed this way:
https://mycontext/someservlet/
or
https://mycontext/foo/nonexisting.html
As far as i can see it, webapps' errors can't be handled with error pages placed in ROOT. I now put the 404.jsp in every webapp (/foo/404.jsp, /bar/404.jsp, ...) and now it works. I can safely delete the 404.jsp in ROOT, but if I delete the 404.jsp in /foo or /bar a blank page is served if a 404 occurres in either webapp. Either tomcat ignores the leading / in the "location" element or the content of this element is appended at the 'calling' webapp's path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With