Hi, Because this processing servlet of yours itself had an error. A JSP file by default is processed by Tomcat's JSP servlet, not your Router servlet. Accordingly, it's not subject to your custom error handling mechanism. A more standard way to do this is declare an <error-page> for 404's in your web.xml, and/or an errorPage for the specific JSP page in the JSP page itself.
Yoav Shapira http://www.yoavshapira.com >-----Original Message----- >From: Jon Doe [mailto:[EMAIL PROTECTED] >Sent: Sunday, December 12, 2004 7:58 PM >To: [EMAIL PROTECTED] >Subject: Query with 404 error processing -- Tomcat 5.0.19 > >Can someone please explain why I get the default Tomcat 404 error when a >pages does not exist? > >I have a set of URLs that end with *.ext. These are all routed to a servlet >called Router, and these all work fine. This servlet has catch-all at the >end that displays an error message when an unknown *.ext is processed. That >all works fine. > >However, when an unknown *.jsp file is processed I get the default Tomcat >error: > > HTTP Status 404 - /unknown.jsp > type Status report > message /unknown.jsp > description The requested resource (/unknown.jsp) is not available. > Apache Tomcat/5.0.19 > >The error in the generates this output in the log file: > >2004-12-13 00:40:10 ApplicationDispatcher[/Server] Servlet.service() for >servlet default threw exception >java.lang.ClassCastException > at >org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorF ilte >r.java:182) > at >org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic atio >nFilterChain.java:233) > at >org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil terC >hain.java:204) >... > >2004-12-13 00:40:10 [EMAIL PROTECTED]: >Exception Processing ErrorPage[errorCode=404, location=/404.html] >java.lang.ClassCastException > at >org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorF ilte >r.java:182) > at >org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic atio >nFilterChain.java:233) > at >org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil terC >hain.java:204) > at >org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispat cher >.java:750) > at >org.apache.catalina.core.ApplicationDispatcher.processRequest(Applicati onDi >spatcher.java:512) >... > >Here is my web.xml file: > ><?xml version="1.0" encoding="UTF-8"?> ><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application >2.3//EN >" "http://java.sun.com/dtd/web-app_2_3.dtd"> ><web-app> > <display-name>My server</display-name> > > <servlet><servlet-name>Router</servlet-name> > <servlet-class>com.mycompany.Router</servlet-class> > </servlet> > <servlet><servlet-name>InitServlet</servlet-name> > <servlet-class>com.mycompany.InitServlet</servlet-class> > <load-on-startup>2</load-on-startup> > </servlet> > > <servlet-mapping><servlet-name>InitServlet</servlet-name> > <url-pattern>/InitServlet</url-pattern> > </servlet-mapping> > <!-- All URLs end .ext. These are processed by the front >controller. >--> > <servlet-mapping><servlet-name>Router</servlet-name> > <url-pattern>*.ext</url-pattern> > </servlet-mapping> > > ><session-config><session-timeout>30</session-timeout></session-config> > > <welcome-file-list><welcome-file>index.html</welcome-file> > </welcome-file-list> > <error-page><error-code>404</error-code> > <location>/404.html</location> > </error-page> ></web-app> > >And my 404.html file: > ><html> ><head> ></head> ><body> >Error! ></body> ></html> > >Any help will be, as always, greatly appreciated. > >Joe. > >_________________________________________________________________ >Express yourself instantly with MSN Messenger! Download today it's FREE! >http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]