You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Wendy Smoak <We...@asu.edu> on 2004/02/24 23:19:34 UTC

Tomcat error-page not working (was: RE: Tomcat and checked vs. unchecked exceptions)

> From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com] 
> Try <exception-type>java.lang.RuntimeException</exception-type>, as
> that's the superclass for unchecked exceptions and you 
> probably want to
> handle them all the same (if you want to handle them at all, which
> apparently you do).

I don't understand. :(  I don't know if this is related to the original
question, but I have this in web.xml:

   <error-page>
      <exception-type>javax.servlet.ServletException</exception-type>
      <location>/WEB-INF/jsp/exceptions/ServletException.jsp</location>
   </error-page>

(in the appropriate place, at the bottom just above </web-app>)

When this code executes:
   if ( report == null || report.equals( "" ) ) {
      log.debug( "doGet: no data!  Need to forward to an error page." );
      throw new ServletException( "No data found in HOLD file" );
   }

I _still_ get this in the browser:

type Exception report
message 
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception 
javax.servlet.ServletException: No data found in HOLD file
	at edu.asu.vpia.webapp.PDFServlet.doGet(PDFServlet.java:94)

Yansheng Lin suggested using Struts declarative exception handling, but
this is a plain-old Servlet, not a Struts Action.

The same <error-page> tag works fine in a different webapp, I'm at a
loss as to why it fails in this one.  The JSP is present in the location
given in the tag.

What am I missing, why do I get a Tomcat-generated error page and not
the JSP I specified?

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat error-page not working (was: RE: Tomcat and checked vs. unchecked exceptions)

Posted by Jerry Ford <jf...@katzenjammer.us>.
Wendy:

Here's your problem:

 >      <location>/WEB-INF/jsp/exceptions/ServletException.jsp</location>

JSPs can't be run from inside the WEB-INF directory. Try moving your 
jsp/exceptions directory up one level.

Jerry

Wendy Smoak wrote:

>>From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com] 
>>Try <exception-type>java.lang.RuntimeException</exception-type>, as
>>that's the superclass for unchecked exceptions and you 
>>probably want to
>>handle them all the same (if you want to handle them at all, which
>>apparently you do).
>>    
>>
>
>I don't understand. :(  I don't know if this is related to the original
>question, but I have this in web.xml:
>
>   <error-page>
>      <exception-type>javax.servlet.ServletException</exception-type>
>      <location>/WEB-INF/jsp/exceptions/ServletException.jsp</location>
>   </error-page>
>
>(in the appropriate place, at the bottom just above </web-app>)
>
>When this code executes:
>   if ( report == null || report.equals( "" ) ) {
>      log.debug( "doGet: no data!  Need to forward to an error page." );
>      throw new ServletException( "No data found in HOLD file" );
>   }
>
>I _still_ get this in the browser:
>
>type Exception report
>message 
>description The server encountered an internal error () that prevented
>it from fulfilling this request.
>exception 
>javax.servlet.ServletException: No data found in HOLD file
>	at edu.asu.vpia.webapp.PDFServlet.doGet(PDFServlet.java:94)
>
>Yansheng Lin suggested using Struts declarative exception handling, but
>this is a plain-old Servlet, not a Struts Action.
>
>The same <error-page> tag works fine in a different webapp, I'm at a
>loss as to why it fails in this one.  The JSP is present in the location
>given in the tag.
>
>What am I missing, why do I get a Tomcat-generated error page and not
>the JSP I specified?
>
>  
>




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org