tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Isaacs <Larry.Isa...@sas.com>
Subject RE: Strange behavior with context mapping and <load-on-startup>
Date Mon, 06 Nov 2000 00:17:50 GMT
In a note about how I accidently replied to a person directly (instead
of tomcat-dev) I accidently replied directly to Hans.  I must not have
something must well connected upstairs. :-)

Larry 

-----Original Message-----
From: Larry Isaacs
To: 'Hans Bergsten '
Sent: 11/5/00 7:01 PM
Subject: RE: Strange behavior with context mapping and <load-on-startup>

Hi,

Sorry my time available for Tomcat has been so sporatic lately, it
has been hard to actually complete something.  I meant to post something
to tomcat-dev after accidentally e-mailing David directly with my
reply about this.

I believe I confirmed with David that his web application was being
served as "/myapp" by the AutoSetup interceptor and again as the root
context by his change to the server.xml.  Thus, two calls to the init().

Larry

-----Original Message-----
From: Hans Bergsten
To: tomcat-dev@jakarta.apache.org
Sent: 11/4/00 6:35 PM
Subject: Re: Strange behavior with context mapping and <load-on-startup>

"Craig R. McClanahan" wrote:
> 
> David Soroko wrote:
> 
> > I am observing the following behavior which I do not understand
(Tomcat 3.1
> > and 3.2b6)
> >
> > The setup:
> >
> > The appdev Hello sample servlet to which the method  init
(ServletConfig
> > config)
> > has been added. It just prints a line of text.
> >
> > To the servlet's web.xml the <load-on-startup>1</load-on-startup>
element
> > has been added
> >
> > To the server.xml the Context element has been added:
> >        <Context path=""
> >                  docBase="webapps/myapp"
> >                  debug="0"
> >                  >
> >         </Context>
> >
> > What I see, is that  when Tomcat starts the init() method is being
invoked
> > twice.
> >
> > Is this a correct behavior or is there something illegal about
path="" ?
> >
> 
> David,
> 
> Try as I might, I could not reproduce this with Tomcat 3.2 -- it
always seems
> to call my init() method once and only once like it is supposed to.
The only
> thing I can think of that might trigger what you are seeing is if you
edited
> the file $TOMCAT_HOME/conf/web.xml instead of the web.xml inside your
web
> application -- that would cause the servlet to get loaded once per web
> application (at least under 3.1).
> 
> If this is not what you did, could you please zip up a copy of the web
> application directory you are using, so that I can reproduce exactly
what you
> are seeing?

Once upon a time this happened when an application was defined by a
<Context>
element and stored in the default webapps directory. Tomcat created one
context
for the <Context> declaration and one for the the WAR (or expanded WAR)
it found
in the webapps directory. 

I haven't tested if this is the case still, but it might be. If so, I
suggest
you 
leave it as it is in 3.2. The simple work-around is to store
applications
defined 
by <Context> elements somewhere else than in webapps.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

Mime
View raw message