File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Custom 404 and 500 errror in JSF using Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Custom 404 and 500 errror in JSF using Tomcat" Watch "Custom 404 and 500 errror in JSF using Tomcat" New topic
Author

Custom 404 and 500 errror in JSF using Tomcat

camilla bat
Greenhorn

Joined: Jul 29, 2005
Posts: 14
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

Joined: Jul 19, 2005
Posts: 25
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

Joined: Jul 18, 2005
Posts: 22
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

Joined: Jul 29, 2005
Posts: 14
Thanks a lot.
I tried and it worked fine.

I had no clue about this.

 
 
subject: Custom 404 and 500 errror in JSF using Tomcat
 
Threads others viewed
Custom Error Page for Error Code 500 in Tomcat
JSP-Error Page HF Servlets &JSP Page 594
Tomcat settings in an production environment?
Please Help - Using JSF
error page under WEB-INF
developer file tools