tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aron Kramlik" <aron.kram...@tenzing.com>
Subject RE: error page deployment descriptor
Date Tue, 11 Jul 2000 23:02:44 GMT
Thanks for the comments so far.  I have changed the order of
the elements in my web.xml.  I put the error-page after the
taglib element as per the Servlet 2.2 spec but as you suggested
the DTD in conf/web.dtd has the error-page before the taglib.

I now get a different error.  If I define an error-code element
for 404 - file not found:

    <error-page>
        <error-code>
       404
        </error-code>
        <location>
           http://localhost/index.html
        </location>
    </error-page>

I then enter an invalid address under one of the tomcat context
applications e.g. localhost/gcs/fdsf
I get the following error, it's an Error 500 - internal servlet error:

Location: /gcs/fdsf

   Internal Servlet Error:
java.lang.NullPointerException:
        at
org.apache.tomcat.core.ContextManager.handleError(ContextManager.java:736)
        at
org.apache.tomcat.core.HttpServletResponseFacade.sendError(HttpServletRespon
seFacade.java:164)
        at
org.apache.tomcat.servlets.DefaultServlet.serveFile(DefaultServlet.java:325)
        at
org.apache.tomcat.servlets.DefaultServlet.doGet(DefaultServlet.java:218)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
        at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:156)
        at
org.apache.tomcat.service.TcpWorkerThread.run(PoolTcpEndpoint.java:366)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:411)
        at java.lang.Thread.run(Thread.java:475)

Has anyone tried to re-direct a HTTP request that is not valid to a
particular
url.  I know this was easy with Apache and it seems it should be just as
easy
with Tomcat through the error-page element but it does not seem to work.

Thanks,
Aron.


-----Original Message-----
From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
Sent: Tuesday, July 11, 2000 1:13 PM
To: tomcat-user@jakarta.apache.org
Subject: Re: error page deployment descriptor


Aron Kramlik wrote:

> Is this the standard DTD for servlets 2.2 or out DTD for the
> custom tag library?  It seems to be complaining about our
> custom tag library which has no mention of error-page obviously
> but I am not sure where it checks for the standard servlets 2.2
> DTD which I want to use.
>
> The last element inside the web-app tag is error-page for me.
> Can you see anything wrong with this?
>

What is happening is a little obscure, but makes sense when you understand
what is going on.

* Tomcat 3.1 does not use a validating
  XML parser when it reads your web.xml
  file, so any "out of order" elements are
  accepted anyway.

* When you use a custom tag, the JSP page
  compiler has to read "web.xml" to locate
  your <taglib> entries.

* The JSP page compiler uses a validating
  XML parser to read "web.xml", so it
  complains if the contents of web.xml are
  invalid.

You did not include your entire "web.xml" file, but there is definitely
something there that is out of order, and needs to be checked against the
DTD for web application deployment descriptors (in the servlet spec at
<http://java.sun.com/products/servlet/download.html>, or in the file
$TOMCAT_HOME/conf/web.dtd in the Tomcat 3.1 final release.

>
> Thanks again,
> Aron.
>

Craig McClanahan


>
> -----Original Message-----
> From: Nacho [mailto:nacho@siapi.es]
> Sent: Tuesday, July 11, 2000 12:06 PM
> To: 'tomcat-user@jakarta.apache.org'
> Subject: RE: error page deployment descriptor
>
> You have a problem about order inside the web-app tag , check the DTD
> for web.xml.
>
> > -----Mensaje original-----
> > De: Aron Kramlik [mailto:aron.kramlik@tenzing.com]
> > Enviado el: martes 11 de julio de 2000 20:45
> > Para: tomcat-user@jakarta.apache.org
> > Asunto: error page deployment descriptor
> >
> >
> > Hello,
> >
> > I have encountered a problem when I added the error page
> > element to the
> > web deployment descriptor.  It's complaining something about
> > the tag library
> > DTD.  I am using Tomcat 3.1 and Apache 1.3.9 on Linux (RedHat and/or
> > Mandrake).
> > I have 3 application contexts (air, gcs, portal).
> > In the tomcat/webapps/air/WEB-INF/web.xml I added the following to the
> > webapps element.
> >
> >     <error-page>
> >         <error-code>
> >        404
> >         </error-code>
> >         <location>
> >            http://localhost/air/inaccessibleURL.html
> >         </location>
> >     </error-page>
> >
> > I get an error when I access a JSP.  I use custom tags and
> > the DTD for this
> > is specified in the same web.xml file as:
> >
> >     <taglib>
> >         <taglib-uri>
> >        http://localhost/air/gcs-taglib
> >         </taglib-uri>
> >         <taglib-location>
> >            /WEB-INF/jsp/gcs-taglib.tld
> >         </taglib-location>
> >     </taglib>
> >
> > I have the DTD in the following file system location:
> > tomcat/webapps/air/WEB-INF/jsp/gcs-taglib.tld
> >
> > The error when I access a JSP is:
> >    Internal Servlet Error:
> > org.apache.jasper.JasperException: Unable to open taglibrary
> > http://localhost/gcs/gcs-taglib : Parse Error in the
> >  tag library descriptor: Element "web-app" does not allow
> > "error-page" here.
> >         at
> > org.apache.jasper.compiler.JspParseEventListener.handleDirecti
> > ve(JspParseEve
> > ntListener.java:672)
> >         at
> > org.apache.jasper.compiler.DelegatingListener.handleDirective(
> > DelegatingList
> > ener.java:116)
> >         at
> > org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215)
> >         at org.apache.jasper.compiler.Parser.parse(Parser.java:1073)
> >         at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
> >         at org.apache.jasper.compiler.Parser.parse(Parser.java:1034)
> >         at
> > org.apache.jasper.compiler.Compiler.compile(Compiler.java:182)
> >         at
> > org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
> >         at
> > org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfN
> > ecessary(JspSe
> > rvlet.java:149)
> >         at
> > org.apache.jasper.runtime.JspServlet$JspServletWrapper.service
> > (JspServlet.ja
> > va:161)
> >         at
> > org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet
> > .java:261)
> >         at
> > org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
> >         at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >         at
> > org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWra
> > pper.java:503)
> >         at
> > org.apache.tomcat.core.RequestDispatcherImpl.forwardRequestDis
> > patcherImpl.ja
> > va:163)
> >         at
> > com.tenzing.servlet.RequestContextImpl.forward(RequestContextI
> > mpl.java:149)
> >         at
> > com.tenzing.servlet.jsp.JSPLauncherServlet.processJSP(JSPLaunc
> > herServlet.jav
> > a:198)
> >         at
> > com.tenzing.servlet.jsp.JSPLauncherServlet.doGetDerivedJSPLaun
> > cherServlet.ja
> > va:149)
> >         at
> > com.tenzing.servlet.ServletBase.handleRequest(ServletBase.java:306)
> >         at com.tenzing.servlet.ServletBase.doGet(ServletBase.java:146)
> >         at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> >         at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >         at
> > org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWra
> > pper.java:503)
> >         at
> > org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> >         at
> > org.apache.tomcat.service.connector.Ajp12ConnectionHandler.pro
> > cessConnection
> > (Ajp12ConnectionHandler.java:156)
> >         at
> > org.apache.tomcat.service.TcpWorkerThread.run(PoolTcpEndpoint.
> > java:366)
> >         at
> > org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPo
> > ol.java:411)
> >         at java.lang.Thread.run(Thread.java:475)
> >
> > Thanks for your help,
> >
> > Aron
> > ---
> >
> > Aron Kramlik
> > Software Engineer
> > Tenzing Communications Inc, Seattle WA
> > aron.kramlik@tenzing.com
> > 425-895-2708
> >
> >
> >
> >



Mime
View raw message