RE: AW: Custom error pages!!
Has anybody sucessfuly configured Tomcat with Apache/mod_jk to use different instances of Tomcat for different virtual domains? I do everything as per documentation, i.e. start two versions of Tomcat specifying different server.xml files, but get error "address already in use" when it comes to opening ports for ajp12. The error message doesn't say which particular address is in use. It seems Tomcat uses at least 2 ports per instance, one is 8080 and the other one is typically, 8007 or whatever. If I only use one port per instance, it won't load. If I use different ports (say 8081 and 8008) it loads but dosen't serve the servlets. I am wondering if anybody has managed to do this. Alexander
Re: AW: Custom error pages!!
Hi: Just to continue on the proposed solutions. I was getting similar problems with Apache1.3 and Tomcat 3.2 (final) in my case whenever an exception occurs Tomcat setting (in the web.xml) would catch the exception and successfully redirect to an error page. But in case of error codes somehow.it just would not happen... i even tried the solution proposed by Kief..i.e. res.sendError("my error code") but somehow this also would not work so finally i had to tweak by program to return an exception in case of a page not found error also. for the time being it has solved my problem as the deadline is near but feel its not a good solution. cheers Pankaj - Original Message - From: "Kief Morris" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 15, 2000 12:31 PM Subject: Re: AW: Custom error pages!! > Scott Jones typed the following on 12:33 14/12/2000 -0800 > > > >500 > >/errors/error.jsp > > > > > >However, this doesn't seem to work at all -- an error in a Cocoon page will > >just give me a plain-ol' stack dump like I normally get from Tomcat. Does > >anyone have any suggestions for this? > > Some things you might try: > - See what happens when you do this for a 400 error, and then try to > access a non-existent page. > - See what happens if you make an error-page to catch exceptions: > > > java.lang.Throwable > /errors/error.jsp > > > It seems likely that may be that exception handling code handles the error > in preference to the error page code. This could be tested with a test servlet > that explicitly returns a 500 response without throwing an exception: > > doGet (...) ... > { > response.sendError(SC_INTERNAL_SERVER_ERROR); > return; > } > > My guess is this would display your error page. > > Kief > > --- > bitBull makes the Internet bite: http://www.bitBull.com/demos/ >
Re: AW: Custom error pages!!
Scott Jones typed the following on 12:33 14/12/2000 -0800 > >500 >/errors/error.jsp > > >However, this doesn't seem to work at all -- an error in a Cocoon page will >just give me a plain-ol' stack dump like I normally get from Tomcat. Does >anyone have any suggestions for this? Some things you might try: - See what happens when you do this for a 400 error, and then try to access a non-existent page. - See what happens if you make an error-page to catch exceptions: java.lang.Throwable /errors/error.jsp It seems likely that may be that exception handling code handles the error in preference to the error page code. This could be tested with a test servlet that explicitly returns a 500 response without throwing an exception: doGet (...) ... { response.sendError(SC_INTERNAL_SERVER_ERROR); return; } My guess is this would display your error page. Kief --- bitBull makes the Internet bite: http://www.bitBull.com/demos/
Re: AW: Custom error pages!!
I'm trying to set up a custom error page for Cocoon & Tomcat. So, I've disabled the internal Cocoon error handling, and then I tried to add an error-page descriptor to web-xml. Ideally, I'd like to re-direct to a jsp file that then would report the error to me by email. 500 /errors/error.jsp However, this doesn't seem to work at all -- an error in a Cocoon page will just give me a plain-ol' stack dump like I normally get from Tomcat. Does anyone have any suggestions for this? Of course, I've written my code to be completely robust, so no errors will ever occur (this is just for completeness)... ;) Thanks! -Scott - Original Message - From: "Catherine Jung" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 12, 2000 8:04 AM Subject: Re: AW: Custom error pages!! > On Tue, 12 Dec 2000, Amrhein, Thomas wrote: > > > With .html it did not work (Tomcat 3.2b6). Haven't tested 3.2 (final). > > Nope - using a location tag pointing to an html file doesn't work in > either b7 or FINAL either (Stack overflow errors after tomcat > seems to get in a loop repeatedly calling the page) however pointing > it to a jsp does work. > > I haven't read anything in the specs to suggest it shouldn't work when > pointing to an html file (in fact all the examples I've seen point to html > files) and it makes no difference if you catch an error code (eg 404) or a > specific error type. I've submitted a bug report, but having no other 2.2 > compliant Servlet engine to use I've not been able to test it anywhere > else. > > > Thanks for your response. The solution really sounds good. > > > > But just for information, can you comment on the tag not > > working in the deployment descriptor of Tomcat 3.2 > > > > Anybody else who has been successful with this can also plese comment. > > > Regards > > Pankaj > > Catherine > >
Re: AW: Custom error pages!!
Hi Catherine: Thanks for your comments. A further extension to the problem : now something seem to go wrong even while redirecting to a jsp for an error code, say 404 the required jsp is not being displyedbut am still getting a 404 error on the browser. (i have tested this out with my deployment descriptor as well as the default one) ne comments are welcome. regards pankaj - Original Message - From: "Catherine Jung" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 12, 2000 5:04 PM Subject: Re: AW: Custom error pages!! > On Tue, 12 Dec 2000, Amrhein, Thomas wrote: > > > With .html it did not work (Tomcat 3.2b6). Haven't tested 3.2 (final). > > Nope - using a location tag pointing to an html file doesn't work in > either b7 or FINAL either (Stack overflow errors after tomcat > seems to get in a loop repeatedly calling the page) however pointing > it to a jsp does work. > > I haven't read anything in the specs to suggest it shouldn't work when > pointing to an html file (in fact all the examples I've seen point to html > files) and it makes no difference if you catch an error code (eg 404) or a > specific error type. I've submitted a bug report, but having no other 2.2 > compliant Servlet engine to use I've not been able to test it anywhere > else. > > > Thanks for your response. The solution really sounds good. > > > > But just for information, can you comment on the tag not > > working in the deployment descriptor of Tomcat 3.2 > > > > Anybody else who has been successful with this can also plese comment. > > > Regards > > Pankaj > > Catherine >
Re: AW: Custom error pages!!
On Tue, 12 Dec 2000, Amrhein, Thomas wrote: > With .html it did not work (Tomcat 3.2b6). Haven't tested 3.2 (final). Nope - using a location tag pointing to an html file doesn't work in either b7 or FINAL either (Stack overflow errors after tomcat seems to get in a loop repeatedly calling the page) however pointing it to a jsp does work. I haven't read anything in the specs to suggest it shouldn't work when pointing to an html file (in fact all the examples I've seen point to html files) and it makes no difference if you catch an error code (eg 404) or a specific error type. I've submitted a bug report, but having no other 2.2 compliant Servlet engine to use I've not been able to test it anywhere else. > Thanks for your response. The solution really sounds good. > > But just for information, can you comment on the tag not > working in the deployment descriptor of Tomcat 3.2 > > Anybody else who has been successful with this can also plese comment. > Regards > Pankaj Catherine
AW: Custom error pages!!
Hi, How is your named? I use JSP and have found, that the itself has to be a .jsp-file. With .html it did not work (Tomcat 3.2b6). Haven't tested 3.2 (final). But I don't expect any changes. Try to name your error-page a .jsp-file and retry it. Perhaps it works. regards, Thomas -Ursprüngliche Nachricht- Von: Pankaj Bhagat [mailto:[EMAIL PROTECTED]] Gesendet am: Dienstag, 12. Dezember 2000 12:59 An: [EMAIL PROTECTED] Betreff: Re: Custom error pages!! Thanks for your response. The solution really sounds good. But just for information, can you comment on the tag not working in the deployment descriptor of Tomcat 3.2 Anybody else who has been successful with this can also plese comment. Regards Pankaj - Original Message - From: "Kief Morris" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 12, 2000 12:26 PM Subject: Re: Custom error pages!! > Pankaj Bhagat typed the following on 11:58 12/12/2000 +0100 > >So now what i can understand is that it should be Tomcat's problem to > >intercept any errors occuring in the servlet and then passing me onto the > >specified url in the deployment descriptor. > > I believe this only applies to JSP pages. For your servlet, you should just > catch it normally: > > public void doGet (...) > { > try { > // your code here > } catch (Throwable e) { > // forward to an error page > } > // write headers and output > } > > If you want to take advantage of JSP error page handling, a slick thing to do > might be to insert the Throwable object into the request as an attribute > named "javax.servlet.jsp.jspException", then forward to a JSP page whose > page directive includes the parameter isErrorPage="true". This will automatically > create a variable called "exception" in the error page, which will be a reference > to the Throwable object you set in the request. > > Check out section 2.7.1 of the JSP specification document for details on how > this works. > > Kief > > --- > bitBull makes the Internet bite: http://www.bitBull.com/demos/ >