Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error pages - error!

 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just trying to set up my first error page, following HFS p458, but instead of getting the error page, I get
HTTP 500 Internal server error.
The page cannot be displayed.
There is a problem with the page you are trying to reach and it cannot be displayed.


The pages I have deployed are badPage.jsp:


and errorPage.jsp:


Why doesn't this show me my error page?

---------------------------

I've found out that if I follow these steps, it will temporarily work:
1. change errorPage="errorPage.jsp" to errorPage="XXXerrorPage.jsp" (Save/deploy - no restart necessary)
2. Retry the request and get "404 - the requested resource is not available."
3. restore setting back to errorPage="errorPage.jsp"
4. Retry the request and Hey presto, error page is shown.
If I then go to a different page and back to badPage.jsp again, I end up back in the HTTP 500 situation and must repeat the above steps!!

Anyone have a clue what's going on here?
(I'm using Tomcat 5.0.28)
 
vishwa venkat
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are the 2 pages are in the same folder when u deploy the app?
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestion, but: Yep - in the application root (otherwise it wouldn't work at all even after step 3).
i.e.:
/webapps/testJstl/badPage.jsp
/webapps/testJstl/errorPage.jsp

and I invoke it from the address bar with:
http://localhost:8080/testJstl/badPage.jsp

Any other ideas?
 
Bart Allen
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I copied your exact code out and ran it successfully on my system. Do you have a DD for this app, and if so, do you possibly have something configured there that might be messing you up?
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange. Thanks for trying it Bart, but shame you didn't get the same as me! Are you using Tomcat 5.0.28?

I have a DD, but nothing much in it - just another servlet I was using prior to testing errorpages.
Here it is in entirety for completeness:


I'm still getting the same problem, and just tried out a couple more scenarios:
Starting with a temporarily working badPage.jsp (as per steps in 1st post):
1. shutdown/restart tomcat, then refresh (F5) badPage.jsp in I.E.
2. close/restart I.E., then goto badPage.jsp again.
3. refresh badPage.jsp, got to different page, go to badPage.jsp again.

with the following results:
1. Still works.
2. Doesn't work.
3. Works but doesn't work on return.

I'm using Windows XP SP2, IE 6.02 SP2. Could it be a bug in I.E.??? (> insert Graemlin for 'clutching at straws'< )

Any other ideas greatly appreciated!
[ October 06, 2004: Message edited by: Roger Yates ]
 
Bart Allen
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tested both on both Tomcat 4.1.18 and 5.0.28 running on Linux.

Accessed both from Mozilla browser on Linux box, and got expected behavior.

Went to a Windows box with I.E. 6.0.2xxxxxxx and accessed the server and got the same result that you are reporting.
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow! Thanks for doing that - I'm not crazy and it's not just *my* machine

Not sure where I go now, though.
Do you have Mozilla on the Windows box? It'd be interesting to see if it is an IE6/Tomcat problem, or a Windows/Tomcat problem.

Think I may raise my first bug on Tomcat...
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Bart!

I just checked the Tomcat bug database and found:
Bugzilla Bug 29505 - Tomcat returns HTTP 500 when I use the JSP error pages mechanism
. Here's a link to the bug report:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=29505

In brief:
The Tomcat guys changed the return code from 200 to 500 for error pages, for consistency.
The bug report concludes there is no problem with Tomcat, just with I.E.
The bug-raiser stated that if the error page is less than 512 bytes they get HTTP 500, but if the error page is larger than 512 bytes, it works fine.

I've tried putting some garbage into my error page to make it bigger than 512 bytes and it works every time now!

...though this doesn't explain why changing the reference to the error page to a duff value, and back again made the small page work temporarily!

From the look of the trace in the bug report, Tomcat is not at fault.

Maybe I wasn't clutching at straws after all, though for peace of mind, I'd like to see what another browser type on Windows displays.
[ October 06, 2004: Message edited by: Roger Yates ]
 
Bart Allen
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roger,

That is really good information to know.

I installed Mozilla on a windows box and tested again... and it worked.

I also tested using IE 5.2 and Safari on a Mac, and both worked.

Looks like the issue is isolated to IE on Windows.

Bart
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bart,

Thanks for testing out those scenarios.

For anyone else reading this thread here's the summary:

Symptom:
"500 internal server error" displayed instead of error page.

Problem:
1. Your jsp specifies an error page
2. Your error page is less than 512 bytes
3. You are using Tomcat 5.0.25 or higher (which is when error code=500)
4. You are running on Windows and using I.E. 6 (not sure if IE 5 on Windows would be ok, or IE6 on another OS)

Resolution:
Either:
1. Ditch Windows and/or IE and use something else instead.
or:
2. Add stuff to your error page to make it bigger than 512 bytes.

-------------------------

.... if you're feeling really keen - do you fancy trying my app error page problem/query in the other thread to see if it works on non-windows/ie?!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic