I made the context fail by not having the database available. Basically, in the contextInitialized method, we need to load various application settings from the database and if the DB is not up, the context fails to load.
The custom error pages are defined in the web.xml for ROOT and context1. All error codes and specific exceptions are forwarded to an ErrorHandlerServlet, which performs additional logging, create custom titles and descriptions based on the error code/exception and then in turn forwards to a JSP which displays the error. I will take a look at the ErrorReportValve and see if I could make use of it. Thanks. Sai Pullabhotla On Wed, May 25, 2011 at 9:04 AM, Pid <[email protected]> wrote: > On 25/05/2011 13:36, Sai Pullabhotla wrote: >> Thanks for the replies and suggestions. >> >> I don't think Tomcat falls back to the ROOT context if another context >> fails to start (unless I'm missing something). >> >> Just to try it out, I did create a subfolder called "context1" in >> ROOT, with an index page in the folder. I made the context1 to fail. >> The log indicates that context1 failed to startup with the following >> error. >> >> SEVERE: Context [/context1] startup failed due to previous errors > > How did you make it fail? > > >> When I try an URL that starts with /context1, I still get Tomcat's >> default error page with a status code of 404, not the custom error >> pages I've in ROOT or the context1. If course, it will never be able >> to load the custom error pages from context1, it does not fall back to >> ROOT either. All other URLs (that do not start with /context1) display >> the custom error pages from the ROOT context. > > How have you defined the custom error pages? > > >> The main reason why we need custom error pages is for security - do >> NOT display any information about the product that may help a hacker >> to run sophisticated attacks. >> >> I guess, it may not be a bad idea for a product (container) to provide >> an option to override error pages. > > > @See ErrorReportValve > > http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/valves/ErrorReportValve.html > > http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html > > > p > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
