2

Can anyone advise me how I can go about disabling Tomcat6 from displaying stacktrace output to the browser?

Tomcat: 6.0.29

I have made the following changes to /opt/apache-tomcat-6.0.29/conf/web.xml

 <error-page>
   <exception-type>java.lang.Throwable</exception-type>
   <location>/error.jsp</location>
 </error-page>

I'm told putting this in place will give a white screen if the file doesn't exist, however I'm getting stack traces to the screen.

EEAA
  • 108,414
  • 18
  • 172
  • 242

3 Answers3

0

I believe that at the top of your .jsp pages you also need to add something like this:

<%@ page errorPage="errorpage.jsp" %>
djangofan
  • 4,172
  • 10
  • 45
  • 59
0

Not sure, but It is possible that you may have to add the error-page element in your applications local web.xml file as well.

yetdot
  • 173
  • 5
  • This may be better as a comment. Perhaps added detail of how to add the element would improve this. – Dave M Aug 02 '16 at 15:16
0

If you put an HTTP server in front of tomcat, not only can you serve a page if tomcat is down, but you can also override the error pages tomcat generates as well as still see the stack traces by going direct to the tomcat.

For example, if you used Apache HTTPD you could use the ProxyErrorOverride directive to display a local HTML pages instead of the stack trace. Something like

# Do not proxy the 500 error page to tomcat
ProxyPass /my500error.html !
# Proxy all other requests to tomcat running an HTTP connector on port 8080
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
# Override 500 error page from tomcat
ProxyErrorOverride on
ErrorDocument 500 /my500error.html

There are lots of variations on this using AJP in stead of HTTP and your HTTP server of choice.

Unbeliever
  • 2,286
  • 1
  • 9
  • 17