This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Why is my error page not invoked?  RSS feed

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using Tomcat 6.0.26 with java 1.6 on Mac 10.6.3. In my WEB-INF/web.xml file, I have



However, a particular JSP page dies with a NumberFormatException, which I can view in Tomcat's localhost log file (stack trace at the bottom). However, I am not redirected to the error page I specify above. Instead, the JSP renders half-way and then stops where the error occurs. What do I need to configure to get the error to properly trigger to the error page?

- Dave


Here's the stack trace in the localhost log from the NumberFormatException ...


 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave,

the web.xml entry shown below will be executed whenever there server HTML response code is 500. how ever if you wish to redirect to error page incase of exception, please try the following web.xml entry.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your reply. I added the directive you specified to my WEB-INF/web.xml …



and then on my JSP page, I intentionally caused an exception …



However, I am still not redirected to my error page (instead just getting an incomplete JSP rendering), even though the below stack trace appears in my localhost log. Any other ideas? - Dave


 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like the flushing of some of the original JSP's content to the output stream is causing the error page mechanism to fail. Which makes some sense, since the response has already been committed before the exception is thrown. In the long-run, you may want to move that processing into a filter or servlet, but here's something you might try for now - make sure you specify a large enough buffer so that partial contents don't get flushed:



...or just try removing buffer="none" if you have it set...
 
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
Download Free Java APIs to Work with Office Files and PDF
htttp://www.e-iceblue.com/free-apis.html
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!