You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Scott Shorter <sh...@caradas.com> on 2002/03/01 15:05:11 UTC

RE: Getting multiple instances of my servlet, although it doesn't implement SingleThreadModel

Randy,

The servlet is defined once in web.xml - one <servlet> tag, that is.  In
addition it is mapped to the root URL with a statement of the form:

  <servlet-mapping>
    <servlet-name>MessageDispatcherServlet</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

Are you saying the servlet mapping is responsible for the multiple
instances?

I don't think that's the case, because I can comment out the mapping and
still get the same results.

Thanks, though.  I'll keep working at it.
-
Scott

> -----Original Message-----
> From: Randy Layman [mailto:randy.layman@aswethink.com] 
> Sent: Friday, March 01, 2002 6:38 AM
> To: 'Tomcat Users List'
> Subject: RE: Getting multiple instances of my servlet, 
> although it doesn't implement SingleThreadModel
> 
> 
> 
> 	Basically, Tomcat will create a separate instance for 
> each unique URL that the servlet responses to.
> 
> 	(Technically, every time you define the servlet in the 
> web.xml there is a separate instance, and another instance is 
> created when you use the ServletInvoker to invoke the servlet 
> by /servlet/className.)
> 
> 	Randy
> 
> 
> > -----Original Message-----
> > From: Scott Shorter [mailto:shorter@caradas.com]
> > Sent: Thursday, February 28, 2002 4:34 PM
> > To: 'Tomcat Users List'
> > Subject: Getting multiple instances of my servlet, although 
> it doesn't 
> > implement SingleThreadModel
> > 
> > 
> > All,
> > 
> > I have a servlet that loads on startup, per the 
> <load-on-startup/> tag 
> > in web.xml.  It does *not* implement SingleThreadModel.
> > 
> > Unfortunately, two instances start up every time Tomcat 
> starts - I can 
> > tell because I have a System.out.println call in init().  I 
> need for 
> > there to be only one instance.
> > 
> > What other settings could be causing multiple instances to happen?
> > 
> > Thanks in advance,
> > Scott
> > 
> > 
> > --
> > To unsubscribe:   
> <mailto:tomcat-user-> unsubscribe@jakarta.apache.org>
> > For 
> additional commands: 
> <ma...@jakarta.apache.org>
> > Troubles with the list: 
> <ma...@jakarta.apache.org>
> > 
> 
> --
> To 
> unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
> 


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>