This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error-Code Tag of web.xml 2.4 not working  RSS feed

 
Chetan Pandey
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • 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
 
pradheesh manohar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!