Women in Technology

Hear us Roar



Article:
  How Servlet Containers Work
Subject:   Servlet init() method not getting called
Date:   2007-04-01 00:36:18
From:   NDLexus
Hi I made a simple class that implements javax.servlet.Servlet and that's the only class that's in my .WAR folder, I run JBOSS and I see it deployes my .WAR file, but the init() method doesn't get triggered. What do I need to do to make the init() method be called? Isn't the servlet instantiated when the web server loads the web app, or does it wait for the very first request to come in? From your sample code I don't see when the init() method is called so it means that it doesn't wait for the first request.


Please help I'm stuck on this one big time.


Thanks.
NDLexus

Full Threads Newest First

Showing messages 1 through 1 of 1.

  • Servlet init() method not getting called
    2008-06-19 13:46:41  jtai1111 [View]

    NDLexus,
    The init() method in any servlet cannot be called until there is a request to the servlet container. We cannot control the calling of the init() method. So you don't directly call the init() method, the servlet container does.

    -hope this helps