aspose file tools*
The moose likes Struts and the fly likes Struts Exception Bounces Me to Tomcat Error Page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Exception Bounces Me to Tomcat Error Page" Watch "Struts Exception Bounces Me to Tomcat Error Page" New topic
Author

Struts Exception Bounces Me to Tomcat Error Page

Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
Hi All,

An exception in struts, for example a NullPointerException, will bounce me out to the default Tomcat Error page.

Is there a way to instead show an error page of my own design?

Thanks You in Advance for Your Help,

Lou
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You could add a global exception handler, for example.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
Hi Lasse,

That works great, thank you!

Unfortunately it works too well.

The exception message and stack trace are not sent to the console.

Any suggestions on how to get the exception message and stack trace to the console AND show the error page of my own design?

Thanks,

Lou
Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
Hi Lasse,

I found more information on your suggestion. I was able to show the user-friendly page and send the exception message and stack trace to the console.

This is the solution I ended up using.

http://www.onjava.com/pub/a/onjava/2002/10/30/jakarta.html

Scroll down to Customizing the Exception Handler.

Thanks,

Lou
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Thanks for posting the link!
 
Don't get me started about those stupid light bulbs.
 
subject: Struts Exception Bounces Me to Tomcat Error Page