You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Lachlan O'Dea <lo...@vet.com.au> on 2000/01/28 13:54:23 UTC
Parsing web.xml
Well today I cvs'd the latest tomcat code. Everything seemed ok until I
trying to use a servlet, when I always got "Class not found", without a
class name being mentioned.
After much investigation (I haven't really looked at the source before)
I worked out that the "invoker" servlet had an empty string as its
associated classname. All of the other servlets had their correct
classnames (which doesn't help without the invoker, of course).
After further investigation I worked out this was happening because the
default web.xml file has the following:
<servlet>
<servlet-name>
invoker
</servlet-name>
<servlet-class>
org.apache.tomcat.servlets.InvokerServlet
<!--
org.apache.tomcat.servlets.NoInvokerServlet
-->
</servlet-class>
It was the comment causing the problem.
After even further investigation I worked out this is due some
assumptions made by the parsing code. The above XML gives you a DOM tree
like so: (bad ASCII art warning)
servlet-class
|
---------------------------------------------------
| | |
pcdata comment pcdata
(org...InvokerServlet) (\n)
Now XMLTree objects can only have one "value" associated with
them. XMLParser was setting the value to the classname, then later
overwriting that with the \n.
I can see two possible fixes: have XMLParser ignore pcdata children
after the first, or have XMLTree concatenate all of the pcdata children
into the one value string. The patches are trivial.
--
Lachlan O'Dea <ma...@vet.com.au> Computer Associates Pty Ltd
Webmaster Vet - Anti-Virus Software
http://www.vet.com.au/
"Your hate has made you powerful." - Emperor Palpatine
Re: Parsing web.xml
Posted by James Todd <jw...@pacbell.net>.
interesting ... i could've sworn that comments in the internal web.xml
used to work. perhaps some new code or another parser has come
onto the scene in the mean time. regardless good catch.
- james
Lachlan O'Dea wrote:
> Well today I cvs'd the latest tomcat code. Everything seemed ok until I
> trying to use a servlet, when I always got "Class not found", without a
> class name being mentioned.
>
> After much investigation (I haven't really looked at the source before)
> I worked out that the "invoker" servlet had an empty string as its
> associated classname. All of the other servlets had their correct
> classnames (which doesn't help without the invoker, of course).
>
> After further investigation I worked out this was happening because the
> default web.xml file has the following:
>
> <servlet>
> <servlet-name>
> invoker
> </servlet-name>
> <servlet-class>
> org.apache.tomcat.servlets.InvokerServlet
> <!--
> org.apache.tomcat.servlets.NoInvokerServlet
> -->
> </servlet-class>
>
> It was the comment causing the problem.
>
> After even further investigation I worked out this is due some
> assumptions made by the parsing code. The above XML gives you a DOM tree
> like so: (bad ASCII art warning)
>
> servlet-class
> |
> ---------------------------------------------------
> | | |
> pcdata comment pcdata
> (org...InvokerServlet) (\n)
>
> Now XMLTree objects can only have one "value" associated with
> them. XMLParser was setting the value to the classname, then later
> overwriting that with the \n.
>
> I can see two possible fixes: have XMLParser ignore pcdata children
> after the first, or have XMLTree concatenate all of the pcdata children
> into the one value string. The patches are trivial.
>
> --
> Lachlan O'Dea <ma...@vet.com.au> Computer Associates Pty Ltd
> Webmaster Vet - Anti-Virus Software
> http://www.vet.com.au/
>
> "Your hate has made you powerful." - Emperor Palpatine
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org