GeeCON Prague 2014*
The moose likes Servlets and the fly likes Bad addresses URL throwing up ugly HTTP 500 with stack trace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Bad addresses URL throwing up ugly HTTP 500 with stack trace" Watch "Bad addresses URL throwing up ugly HTTP 500 with stack trace" New topic
Author

Bad addresses URL throwing up ugly HTTP 500 with stack trace

Samrat Roy
Greenhorn

Joined: May 14, 2009
Posts: 4
The application I am currently working throws up ugly stack traces if the url entered is wrong ; For example :

if you enter http://blahBlah.zapdata.com the tomcat will display an UGLY HTTP status 500 with a Catalina stack trace :


This is not a valid address.. But if you enter http://blahBlah.google.com , the website displays a clean error message like .


How can I configure tomcat to display clean error messages and not a stack trace?

I have tried the error page tag <error-page><error-code> in the web.xml of the application , that works fine if there is a genuine problem with the application but not when the initial url entered is wrong.

Please HELP !!!


In theory: there is no difference between theory and practice ; in practice there is!
Charles 'King
Ranch Hand

Joined: Jul 05, 2009
Posts: 56

You can configure your app to catch all exceptions by using the correct syntax in the DD. Additionally, if you're using JSP's, you can use the error page attribute of page directive. Review sun's example: http://java.sun.com/blueprints/guidelines/designing_enterprise_applications/packaging_deployment/descriptors/index.html

If you still have questions, post your DD error page section.

As an aside, is your question intrinsic to your app or are you attempting to handle all errors returned by the container regardless of app?
 
GeeCON Prague 2014
 
subject: Bad addresses URL throwing up ugly HTTP 500 with stack trace