You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Harish Rawat <Ha...@oracle.com> on 2000/08/19 01:38:42 UTC

Init method of the servlet getting called five times

I saw a strange behaviour in tomcat. While loading a servlet it calls the init method five times (and the destroy method is not called),  whereas with Jserv for the same servlet the init method is called only once.

Any reasons why this could be happening?
Thanks
Harish

Re: Init method of the servlet getting called five times

Posted by ALEXANDROS KOTSIRAS <AL...@prodigy.net>.
Maybe this is not the reason in your case but in general if you  are using inheritance with your servlets, every time that 
the init() method of a child Servlet is called it will always call first the init() method of the parent Servlet even if the parent Servlets init() was called before. So if you have 5 child servlets your parent servlet's init() will be called at least 5+1 times. This behavior though should be identical on JServ and Tomcat.

Alex.
  ----- Original Message ----- 
  From: Harish Rawat 
  To: tomcat-user@jakarta.apache.org 
  Sent: Friday, August 18, 2000 7:38 PM
  Subject: Init method of the servlet getting called five times


  I saw a strange behaviour in tomcat. While loading a servlet it calls the init method five times (and the destroy method is not called),  whereas with Jserv for the same servlet the init method is called only once.

  Any reasons why this could be happening?
  Thanks
  Harish