• Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom 404 and 500 errror in JSF using Tomcat  RSS feed

 
camilla bat
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might not match this forum, but I'll try anyway:

We're using JSF techn. running on Tomcat 5.5.
We're trying to create a custom error page, which should be quite simple, but it simply doesn't work.

In the web.xml I have this:
<error-page>
<error-code>500</error-code>
<location>/server_error.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/file_not_found.jsp</location>
</error-page>

When I force a e.g. 500 error these line are probably read. It does no longer show the internal Tomcat 500 error, but now insted just the IE 500 error. It doesn't seem to find the server_error.jsp which is in the root of the webdir. I have tried with an absolutepath, i.e. /webapp/server_error.jsp, but with no help.

Does anyone have any idea about this? I have tried to move the bit of code around in the web.xml, but with no help.
Any other way to display such errors?

Thanks
 
Jiang Xiaofeng
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by camilla bat:
This might not match this forum, but I'll try anyway:

We're using JSF techn. running on Tomcat 5.5.
We're trying to create a custom error page, which should be quite simple, but it simply doesn't work.

In the web.xml I have this:
<error-page>
<error-code>500</error-code>
<location>/server_error.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/file_not_found.jsp</location>
</error-page>

When I force a e.g. 500 error these line are probably read. It does no longer show the internal Tomcat 500 error, but now insted just the IE 500 error. It doesn't seem to find the server_error.jsp which is in the root of the webdir. I have tried with an absolutepath, i.e. /webapp/server_error.jsp, but with no help.

Does anyone have any idea about this? I have tried to move the bit of code around in the web.xml, but with no help.
Any other way to display such errors?

Thanks




This is just a guess but I believe there was an issue with IE rendering its own 500 page if the 500 page returned was very small in size.

Have you tried to force a 500 with a different browser?
 
Mauro Castaldo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IE overrides several HTTP error status pages but it has a size threshold. Basically if the error page send by the server has a large enough body then IE decides it's meaningful and displays it.

Usually to be safe you should make error pages that are larger then 512 bytes. The threshold varies per HTTP status code. You can look at what your thresholds are currently set to. In IE 5 and greater the settings are stored in the registry under[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\ErrorThresholds]

Err Size(bytes)
400 512
403 256
404 512
405 256
406 512
408 512
409 512
410 256
500 512
501 512
505 512
 
camilla bat
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.
I tried and it worked fine.

I had no clue about this.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!