By default, all current released versions of Tomcat (i.e. 3.3.1-5.0.3) implement instance-pooling for STM Servlets. The servlet-spec explicitly allows the Container (aka Tomcat) to implement STM Servlets this way, so, no, it is not a bug. You should expect to get multiple instances of your Servlet, and hence multiple calls to init.
"Hal Lander" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The init method of my servlet is called twice if my class implements the > SingleThreadModel. > Full details are given below. If I remove "implements SingleThreadModel" > init is called only once - as I would expect. > > Is this a bug? > Any help would be appreciated. > > Hal. > > > > THE SOURCE CODE > ================ > import javax.servlet.http.HttpServlet; > import javax.servlet.SingleThreadModel; > > public class x extends HttpServlet implements SingleThreadModel > //******************************** > { > public void init() > //**************** > { > System.out.println("init called"); > return; > } > } > > > URL USED TO INVOKE SERVLET > ========================== > http://localhost:8080/examples/servlet/x > > > > OUTPUT IN "START TOMCAT" WINDOW > =============================== > Starting service Tomcat-Standalone > Apache Tomcat/4.0.4 > Starting service Tomcat-Apache > Apache Tomcat/4.0.4 > init called > init called > > > localhost_examples_log.2003-06-27.txt > ===================================== > 2003-06-27 11:39:09 WebappLoader[/examples]: Deploying class repositories to > work directory C:\Program Files\Apache Tomcat > 4.0\work\Standalone\localhost\examples > 2003-06-27 11:39:09 WebappLoader[/examples]: Deploy JAR > /WEB-INF/lib/httpclient.jar to C:\Program Files\Apache Tomcat > 4.0\webapps\examples\WEB-INF\lib\httpclient.jar > 2003-06-27 11:39:09 WebappLoader[/examples]: Deploy JAR > /WEB-INF/lib/logging.jar to C:\Program Files\Apache Tomcat > 4.0\webapps\examples\WEB-INF\lib\logging.jar > 2003-06-27 11:39:09 WebappLoader[/examples]: Reloading checks are enabled > for this Context > 2003-06-27 11:39:09 StandardManager[/examples]: Seeding random number > generator class java.security.SecureRandom > 2003-06-27 11:39:09 StandardManager[/examples]: Seeding of random number > generator has been completed > 2003-06-27 11:39:09 ContextConfig[/examples]: Added certificates -> request > attribute Valve > 2003-06-27 11:39:09 ContextConfig[/examples]: Configured an authenticator > for method FORM > 2003-06-27 11:39:09 ContextListener: contextInitialized() > 2003-06-27 11:39:09 SessionListener: contextInitialized() > 2003-06-27 11:39:09 ContextListener: > attributeReplaced('org.apache.catalina.WELCOME_FILES', > '[Ljava.lang.String;@1f6226') > 2003-06-27 11:39:09 StandardWrapper[/examples:default]: Loading container > servlet default > 2003-06-27 11:39:09 default: init 2003-06-27 11:39:09 > StandardWrapper[/examples:invoker]: Loading container servlet invoker > 2003-06-27 11:39:09 invoker: init 2003-06-27 11:39:09 jsp: init 2003-06-27 > 11:39:45 org.apache.catalina.INVOKER.x: init > 2003-06-27 11:39:45 org.apache.catalina.INVOKER.x: init > 2003-06-27 11:39:45 InvokerFilter(ApplicationFilterConfig[name=Servlet > Mapped Filter, filterClass=filters.ExampleFilter]): 20 milliseconds > 2003-06-27 11:39:45 InvokerFilter(ApplicationFilterConfig[name=Path Mapped > Filter, filterClass=filters.ExampleFilter]): 20 milliseconds > 2003-06-27 11:40:04 SessionListener: contextDestroyed() 2003-06-27 11:40:04 > ContextListener: contextDestroyed() > 2003-06-27 11:40:04 org.apache.catalina.INVOKER.x: destroy 2003-06-27 > 11:40:04 org.apache.catalina.INVOKER.x: destroy > > _________________________________________________________________ > Add photos to your e-mail with MSN 8. Get 2 months FREE*. > http://join.msn.com/?page=features/featuredemail --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
