aspose file tools*
The moose likes JSP and the fly likes unable to configure custom error pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "unable to configure custom error pages" Watch "unable to configure custom error pages" New topic
Author

unable to configure custom error pages

Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 42

Hello All,
I am using tomcat 5.0.16 and i used the following code to configure error pages in web.xml:

When an exception occurs, then my custom page is being displayed. But the page configured with the error code doenst display when i request for a non-existent resource such as a jsp.
Can anyone point to whats wrong with my config code?

Regards
Dinkar
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

On which browser did you try it ? Please try both Firefox and IE is you can.


[My Blog]
All roads lead to JavaRanch
Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 42

But I thought that when the error occurs on the server end, then the server will generate an error page and send it to the browser. If we have configured an error page, then the server should pick up the appropriate page and send it across.
How is it related to the browser?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

IE has a nasty option to show its own error messages. I don't know the english name for this option. It's in Tools/Internet Options/Advanced/". Maybe called "Show friendly HTTP messages"
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Found it with Google. It's an option called "Show friendly HTTP error messages". Turn it off.
Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 42

But what is bothering me is the fact that the error page that is being displayed is coming from tomcat and not being displayed by IE.
Its the usual one that you get to see when you try to access a resource that doesnt exist.
The bottom line tells its coming from apache..
here is the code of the page produced: I am sure its being sent by tomcat..

<html><head><title>Apache Tomcat/5.0.16 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /scwcd/no.jsp</h1><HR size="1" noshade><p><b>type</b> Status report</p><p><b>message</b> <u>/scwcd/no.jsp</u></p><p><b>description</b> <u>The requested resource (/scwcd/no.jsp) is not available.</u></p><HR size="1" noshade><h3>Apache Tomcat/5.0.16</h3></body></html>


My problem is why is tomcat sending its own error page when i have configured my page to be displayed? Is there anything wrong with the configuration code that i have written in the first post?

Regards
Dinkar
[ April 16, 2007: Message edited by: Ben Souther ]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Sorry, I can't get that one. Do you have a file called "/catchError.jsp" ?
You obviously have one called /catchAllError.jsp, but do you also have one called catchError.jsp ?

If you could also try with a newer version of Tomcat...
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Normally, we stress using the UBB code tags.
If, however, your entire page is written on one line, doing so will make the thread even harder to read.

Please take the time to format your code before posting to the forum.
Doing so will increase your chanced of getting a quick and accurate answer to your question.
[ April 16, 2007: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Yossi Shmulevitch
Greenhorn

Joined: Apr 26, 2007
Posts: 1
I'm using tomcat 5.5.20 and got the same issue:

If you configured conf/web.xml you need to place this jsp under ROOT package and under each web application as well.

Hope it helped.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to configure custom error pages