any webapp whose physical location is a subdirecty of the 'appBase' setting
in your server.xml(default is 'webapps') will be loaded as a context
automatically by tomcat. 

take this example:
you have a context defined in /tomcat/webapps/aaa

the default 'appbase' is webapps. So aaa would automatically be loaded by
tomcat even if you didn't define a <context> for it in server.xml.
this way you can access it as www.myhost.com/aaa

now if you defined a <context> such that www.myhost.com/bbb is using the
context aaa, then you now have two ways to access your context, each loaded
separately.

to disable the automatic loading, change your appbase to an empty
directory(i.e. "/tomcat/webapps/dummy")

Charlie

> -----Original Message-----
> From: Rui Fernandes [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 29, 2002 11:30 AM
> To: Tomcat Users List
> Subject: RE: Servlet Instances
> 
> 
> I don't understand what you say.
> Would you be able to explain it again in more detail.
> 
> > your context may also be autoloaded in addition to your 
> definition in
> > server.xml. This would cause it to load your context 
> again,therefore your
> > servlet. Disable this bey setting appBase to some other directory.
> >
> 
> This is the most likely explanation.
> 
> > HTH
> > Charlie
> 
> 
> 
> ----- Original Message -----
> From: Craig R. McClanahan <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Sent: Thursday, August 29, 2002 5:33 PM
> Subject: RE: Servlet Instances
> 
> 
> >
> >
> > On Thu, 29 Aug 2002, Cox, Charlie wrote:
> >
> > > Date: Thu, 29 Aug 2002 08:47:39 -0400
> > > From: "Cox, Charlie" <[EMAIL PROTECTED]>
> > > Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> > > To: 'Tomcat Users List' <[EMAIL PROTECTED]>
> > > Subject: RE: Servlet Instances
> > >
> > > well, a new class instance is created for each mapping 
> that you have in
> > > web.xml. If you only call your servlet with the first 
> mapping, then this
> is
> > > why only one is called.
> > >
> >
> > Actually, a new instance is created per <servlet> 
> definition, not per
> > <servlet-mapping>.  It's legal to have more than one 
> mapping to the same
> > instance.
> >
> > > your context may also be autoloaded in addition to your 
> definition in
> > > server.xml. This would cause it to load your context 
> again,therefore
> your
> > > servlet. Disable this bey setting appBase to some other directory.
> > >
> >
> > This is the most likely explanation.
> >
> > > HTH
> > > Charlie
> >
> > Craig
> >
> > >
> > > > -----Original Message-----
> > > > From: Rui Fernandes [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, August 29, 2002 8:13 AM
> > > > To: Tomcat Users List
> > > > Subject: RE: Servlet Instances
> > > >
> > > >
> > > > My servlet does something on init and on destroy and each
> > > > time doget is
> > > > called.
> > > > Specifically do some log to a file which it creates.
> > > > The file is created twice at very close times, the same with
> > > > the logged
> > > > messages at startup. With the shutdown the same thing. 
> Shutdown calls
> > > > destroy for the 3 instances.
> > > >
> > > > But the log messages for doGet cases only are written in one
> > > > of the files.
> > > > So the same servlet is handling all remote requests. But for
> > > > some reason 3
> > > > servlet instances are running.
> > > > I do not have my webapp duplicated on configuration files.
> > > >
> > > > This thing doesn't happen in my local development machine
> > > > (Windows), only on
> > > > the production remote one (Linux).
> > > >
> > > > Help?...
> > > >
> > > > ----- Original Message -----
> > > > From: Cox, Charlie <[EMAIL PROTECTED]>
> > > > To: 'Tomcat Users List' <[EMAIL PROTECTED]>
> > > > Sent: Thursday, August 29, 2002 1:48 PM
> > > > Subject: RE: Servlet Instances
> > > >
> > > >
> > > > > keep in mind that static is only "static" within the current
> > > > > classloader(your webapp).
> > > > >
> > > > > your servlets will have many threads that share your 
> servlet member
> > > > fields,
> > > > > but each request is on its own thread, so the doGet()
> > > > instance is unique
> > > > to
> > > > > that request.
> > > > >
> > > > > how do you know that you have 3 instances of the servlet?
> > > > have you defined
> > > > > multiple times in web.xml or have you defined 3 contexts
> > > > that share the
> > > > same
> > > > > servlet?
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Rui Fernandes [mailto:[EMAIL PROTECTED]]
> > > > > > Sent: Thursday, August 29, 2002 6:41 AM
> > > > > > To: Tomcat Users List
> > > > > > Subject: RE: Servlet Instances
> > > > > >
> > > > > >
> > > > > > No,
> > > > > > Is just like that.
> > > > > > But I change things with static variables to control that
> > > > > > servlets don't
> > > > > > instantiate what others instantiated before, and share
> > > > access to the
> > > > > > necessary classes through static references.
> > > > > > But I find that this doesn't solve the problem... My
> > > > > > conclusion, somehow
> > > > > > there are 3 Tomcats running!?!? But only one seems to be
> > > > > > responsible for
> > > > > > remote calls.
> > > > > >
> > > > > > Strange, very strange indeed.... just can't get it.
> > > > > >
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: Nikola Milutinovic <[EMAIL PROTECTED]>
> > > > > > To: Tomcat Users List <[EMAIL PROTECTED]>
> > > > > > Sent: Thursday, August 29, 2002 12:29 PM
> > > > > > Subject: Re: Servlet Instances
> > > > > >
> > > > > >
> > > > > > > > No, I am saying I have three instances of the same
> > > > > > servlet. Only one
> > > > > > appears
> > > > > > > > to be receiving the requests, but if things are like you
> > > > > > say then what's
> > > > > > > > going on with Tomcat? Are you saying I have 
> three Tomcats
> > > > > > running, even
> > > > > > > > thought I called startup only once?
> > > > > > >
> > > > > > > Are you sure? Could it be that your mixing instances of
> > > > a class with
> > > > > > threads running in the engine?
> > > > > > >
> > > > > > > Otherwise it is very strange.
> > > > > > >
> > > > > > > Nix.
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > To unsubscribe, e-mail:
> > > > > > <mailto:[EMAIL PROTECTED]>
> > > > > > For additional commands, e-mail:
> > > > > > <mailto:[EMAIL PROTECTED]>
> > > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to