• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error-Code Tag of web.xml 2.4 not working

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All:

My JSP/Servlet Error are not being redirected using the <error-page> Tag.

The following is my declaration of Error Pages in my web.xml

<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<error-page>
<error-code>404</error-code>
<location>/errorPage.jsp</location>
</error-page>

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



If I do <%@ page errorPage="/errorPage.jsp"%> in a JSP Page and an Exception occurs.

Tomcat correctly redirects me to the errorPage.jsp

However, if I omit the above declaration from the JSP Page, I get the following error:

Oct 30, 2006 8:39:40 PM org.apache.catalina.core.StandardHostValve custom
SEVERE: Exception Processing ErrorPage[exceptionType=java.lang.Exception, location=/errorPage.jsp]
java.lang.IllegalStateException
at org.apache.coyote.Response.reset(Response.java:296)

Is it something to do with the order of the <error-page> tag. We are told that web.xml 2.4 spec doesnt care about the order of its elements.

Any suggestions pls.

Thanks.

Chetan
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi chetan
try this <%@ page isErrorPage="true"%> in your errorPage.jsp


reg,
pradheesh
 
Chetan Pandey
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Manohar:

I am already doing the following:

<%@ page isErrorPage="true"%> in my errorPage.jsp and as I said it works when I declare it in a JSP PAge but not when I declare it in my web.xml(2.4) for Tomcat 5.5

Thanks.

Chetan
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chetan Pandey:

Oct 30, 2006 8:39:40 PM org.apache.catalina.core.StandardHostValve custom
SEVERE: Exception Processing ErrorPage[exceptionType=java.lang.Exception, location=/errorPage.jsp]
java.lang.IllegalStateException
at org.apache.coyote.Response.reset(Response.java:296)



It looks like it is forwarding to your errorPage.jsp.
Then the error page itself is blowing up with an IllegalStateException.

Perhaps you've already committed the response before whatever error caused the context to be forwarded to your error page?
 
reply
    Bookmark Topic Watch Topic
  • New Topic