I do get my custom error page when an error happens in a servlet init() method. But you didn't give many details about your problem, so I can't say whether you should be seeing custom error pages on your system.
First of all, you didn't say what version of Tomcat you're using. If it's older than 5.5, it could act differently from what I've seen. Secondly, I'm assuming the "errors" you speak of are exceptions that are thrown by the init() method. Not HTTP error status codes. (You can't call response.sendError() in init().). Normally, the servlet's init() is called when the first HTTP request is received for that servlet, and if it throws an exception a custom error page will be displayed as usual. If the servlet has "load-on-startup" specified in web.xml, init() is called when the server starts up, before there are any web requests - so obviously it can't return an error page to anyone. But then init() will be called *again* when a request is received for the servlet, and you'll see your error page then. Two reasons why you might not see your custom error page: 1. Error in the custom error page. 2. Error in the <error-page> declaration. To define a custom error page for all exceptions, do this in your application's web.xml: <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/yourErrorPage.jsp</location> </error-page> -- Len On Nov 13, 2007 6:19 PM, Adam Parker <[EMAIL PROTECTED]> wrote: > I am trying to override tomcat error pages, and I have tried various > combinations of the <error-pages> element in both the global web.xml, and my > application web.xml. Nothing is working. > > After some research I believe the problem is that the error I am looking at > actually occurs in the servlet.init(config) call. This call doesn't seem to > happen in the normal request processing loop, and hence the <error-pages> is > never used and a generic tomcat error is returned. > > Is there anyway to override this error even when outside the context of a > request/reply? > > Any info on how the error is returned without a request/reply would be > greatly appreciated. > > -Adam Parker > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]