tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Bug found when calling init methods of defined web apps
Date Thu, 27 Jul 2000 22:43:35 GMT
Dan Martens wrote:

> If you had read the rest of my post you would have noticed that I mentioned
> that each entry in the conf/web.xml file is being loaded four different
> times.  So essentially the same file is being parsed four different times.
> This cannot at all be the correct behaviour at all because this is causing
> four different instances of every single defined webapp in the file, all
> with the same mapping. If still do not know what I mean, create a simple
> testing servlet with a println statement in the init method.  Define this
> servlet in the conf/web.xml file with the a loadatstartup value of 1 or any
> other +ve integer.  Then run tomcat, and watch the standard out.  This
> should clarify my point.

If you define your servlet in "conf/web.xml", and there are four webapps, four
init messages is *exactly* what you should see -- one for the instance of this
servlet loaded in each webapp.  After all, the point of this file is to define
things that should be loaded for *every* web application.  Try printing out the
value of
in the println() message, and you will see what I mean.  The real path of "/"
for each webapp will be the pathname to the document root directory for that

If you define your sevlet in the "WEB-INF/web.xml" file for your own web
application (which is what you should be doing for portability -- reading
"conf/web.xml" is a Tomcat-specific feature), it will be initialized just once.


View raw message