The snippet you quoted looks fine, but there must be some other occurrence
of <load-on-startup> that is not fine. Could you quote the entire web.xml
file instead? Also, check around the exception report in the log file --
often, the parser will include some indication of what line number it is
on when it encounters an error,
As a general note, Tomcat 4 uses a validating XML parser when reading
web.xml files, to help you ensure that your web apps will be portable to
any container. A consequence of this is that you must follow the element
ordering requirements in the DTD *exactly*. Tomcat 3.2 did not do a
validating parse, so it accepted invalid web.xml files.
The DTD is published in the Servlet Specification, which can be downloaded
from:
http://java.sun.com/products/servlet/download.html
Craig McClanahan
On Fri, 21 Sep 2001, Graham Leggett wrote:
> Date: Fri, 21 Sep 2001 18:13:05 +0200
> From: Graham Leggett <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: Tomcat User <[EMAIL PROTECTED]>
> Subject: <load-on-startup> and Tomcat v4.0
>
> Hi all,
>
> I have just been trying to get a servlet application transferred from
> Tomcat v3.2 to v4.0. It's worked fine before with v3.2, but on starting
> v4.0, I get an error like so:
>
> org.xml.sax.SAXParseException: Element "servlet" does not allow
> "load-on-startup" here.
>
> Unfortunately the error message does state where "here" is, however I do
> have it defined like so:
>
> <servlet>
> <servlet-name>WWWW</servlet-name>
> <servlet-class>XXX</servlet-class>
> <init-param>
> <param-name>YYY</param-name>
> <param-value>ZZZ</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> And a second similar container with
> <load-on-startup>2</load-on-startup>.
>
> I have been trawling the docs to find out how the "load-on-startup" is
> supposed to work, but can find no details (I set up servers, but I don't
> program java :( )...
>
> Can anyone shed some light?
>
> Regards,
> Graham
> --
> -----------------------------------------
> [EMAIL PROTECTED] "There's a moon
> over Bourbon Street
> tonight..."