Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set up custom error pages in tomcat 6, because I don't want the default ones to show up. My error pages are static html, no jsp or anything dynamic.

I know how to do this through the web.xml in each application but I'd prefere to setup the error pages only once for the entire server.

I tried to add the following fragment to the global web.xml (in conf), but no matter what I add under location, it does not show.

<error-page>
    <error-code>404</error-code>
    <location>/404.html</location>
</error-page>

What do I need to do to gobally define custom error pages? Thanks!

share|improve this question
add comment

1 Answer

Your syntax is correct (and worked fine for me). But you will need a file called 404.html at the root level for every webapp deployed for it to work.

If you do NOT want to do that - there is the little know errorReportValveClass as part of StandardHost in which you can provide your own implementation of a class to handle all the uncaught errors.

http://tomcat.apache.org/tomcat-6.0-doc/config/host.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.