tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maurice Marrink" <>
Subject RE: custom error pages
Date Thu, 05 Aug 2004 12:56:08 GMT
Thanks for the reply.
I think you might have misunderstood my second request.
Tomcat allows you to define custom errorpages by specifying them in the
conf/web.xml file as a default for all webapps (existing or nonexisting)
What I would like to request is that these defaults are checked before
sending the tomcat error. Imo this is not a hack, what I did with the
listeners was a hack and I thought I made that clear.
Maybe I need to clarify this a bit more.
If I specify a custom errorpage in the /conf/web.xml it is this error
(provided I used the right http error code) that gets shown whenever I
go to a non existing webapp/url. What I would like is to have a stopped
webapp behave in the same way. (at least for errorpages).

Maurice Marrink

-----Oorspronkelijk bericht-----
Van: Shapira, Yoav [] 
Verzonden: donderdag 5 augustus 2004 14:37
Aan: Tomcat Users List
Onderwerp: RE: custom error pages

I'll save you time and tell you your 2nd request will not happen.  A
webapp is a webapp including its error pages.  If it's off, it's off,
including its error pages.  We won't put in hacks like hard-coding a
backup location for error pages.

Yoav Shapira
Millennium Research Informatics

>-----Original Message-----
>From: Maurice Marrink []
>Sent: Thursday, August 05, 2004 3:53 AM
>Subject: custom error pages
>I,m using tomcat 5.0.27 and am trying to show custom error pages.
>I added a couple of errorpage tags to my webapps web.xml and the
>/conf/web.xml in the tomcat installation dir.
>		<error-code>500</error-code>
>		<location>/error/error.html</location>
>and after telling internet explorer not to use userfriendly errorpages
>shows the errorpages defined in my webapp when I try to access an
>nonexisting url inside my webapps context (e.g.
>/my_existing_webapp/does_not_exist.html) and shows the default
>when I go to an url that does not exist at all (e.g.
>/non_existing_webapp/whatever.html), that is after I copied my error
>into the ROOT context.
>But I cant get it to work when my webapp is defined but not running.
What I
>did was this:
>- start tomcat
>- goto the manager webapp
>- shutdown the webapp with custom errorpages
>- enter a valid url for that webapp in the browser.
>Now I get the standard tomcat errorpage.
>So I did a little debugging and found that when tomcat stops a webapp,
>preserves the context it just strips it from all but the name (well
>So my custom defined errorpages are gone and because tomcat did find a
>context it wont use the errorpages defined in the default web.xml (or
>context) but instead goes for the tomcat errorpage.
>I thought I could outsmart tomcat, so I made a little lifecylelistener
>container listener so I would get notified of the removal of my
>and then put them back in. Even though that works, tomcat still shows
>own errorpages because further down the line it tries to get a
>requestdispatcher from the context (which was stripped) to forward the
>request for the errorpages. And there it fails offcourse.
>Now we get to the question(s) :)
>- does anyone know what else needs to be preserved in the context in
>to deliver a valid requestdispatcher (there is a lot that gets removed,
>its probably quicker to get an answer from you guys then painstakingly
>trial and error)
>- or perhaps a better question could you guys (developers) make the
>(nightly) release so that it tries to get errorpages from the default
>web.xml (root context) before showing the tomcat errorpage. Because its
>then likely my little hack is going to break something if I get it to
>If no one can or bothers to answer the first question I can live with
>I've surrendered :) but I would like to see the 2nd request/ feature to
>Maurice Marrink
>To unsubscribe, e-mail:
>For additional commands, e-mail:

This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged.  This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an)
intended recipient, please immediately delete this e-mail from your
computer system and notify the sender.  Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message