• Post Reply Bookmark Topic Watch Topic
  • New Topic

I don't want expose my application's behind to everyone!  RSS feed

 
Kamila Rutkowski
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some times some exceptions like NullPointer occur within my JSF/Facelets application and everything displayed on browser for end user! How to prevent Java web application on Tomcat to show full exception in web page?
 
leo donahue
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to include an error page element in your web.xml that handles the exceptions you choose, which should prevent Tomcat from displaying the stack trace to your page viewers when things go bad. The error-page will navigate the user to whatever page you specifiy.

Java Servlet 2.5 Specification

Download the 2.5 Final Release and read page 76, or pdf page 70 where it talks about configuring error pages.

Then read page 142/136 where is shows you what the error-page element contains.

On page 153 is an example.

You might also want to visit this page: JavaServer Faces 1.2 API and look at the FacesException.
 
Kamila Rutkowski
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help. I did it but nothing occured and the same exception stack dispalyed in browser! I use Facelets and this is maybe the cause of problem

I put all of these within web.xml:



and this is what I see in browser:


 
leo donahue
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You really don't want to hide this message, do you? NullPointerException? Where is it coming from? You are using an object reference that has not been initialized?

I would find and fix this problem instead of trying to hide the stack trace. Is your webapp working correctly?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!