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.

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.

HTH
Charlie

> -----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]>

Reply via email to