title: ServletContextListener does not execute on deployment
body: <p>I am trying to initialize a streaming object when my war file is deployed.</p>
  
  <p>I wrote an Initializer class that implements ServletContextListener and added a listener-class tag to my web.xml. The issue is that the ContextInitialized Event occurs when I make the first request to my application and NOT when the app is deployed.</p>
  
  <p>Is there a better way to initialize my application?</p>
  
  <p>EDIT:</p>
  
  <pre><code>public class Initializer implements ServletContextListener{
  
  @Override
  public void contextDestroyed(ServletContextEvent arg0) {
      System.out.println("Context Destroyed");
  
  }
  
  @Override
  public void contextInitialized(ServletContextEvent arg0) {
      System.out.println("Context Initialized");
  }
  
  }
  </code></pre>
  
  <p>From the web.xml:</p>
  
  <pre><code>&lt;listener&gt;
      &lt;listener-class&gt;thepackage.Initializer&lt;/listener-class&gt;
  &lt;/listener&gt;
  </code></pre>
  
  <p>EDIT 2:
  Found the solution and posted below.</p>