What happens when web server will start

What happens when Web Server will start

  • When Web Server starts then Web Container will be started
After Web Container Start Up following tasks will be happen:
  • Web Container reads the data from web.xml file and stores the data in main memory.
  • Container create the ServletContext object and initializes ServletContext object with the context parameters specified in web.xml
  • Thread pool will be created by the Container
  • All the Listeners will be initialized
  • All the Filters will be initialized
  • Container checks whether any servlet is configured with <load-on-startup> tag then that servlet will be initialized.
When Container is initializing the Servlet at Container start-up, Container will do the following tasks:
  • Servlet class will loaded.
  • Servlet instance will be created by calling default constructor.
  • Container will caste the instance into javax.servlet.Servlet type to ensure it is a servlet.
  • Container creates the ServletConfig object and initializes ServletConfig object with the config parameters specified in web.xml.
  • Container call the init() method by passing ServletConfig object as parameter.


Post a Comment