title: Tomcat server runs twice on startup
body: <p>I am running my spring application. On starting tomcat 7 server, it gets loaded twice before restfull services before it gets started.
  There are certain scheduler in the application which also runs twice due to this.
  Is this realted to my web.xml file.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  
  
  
      &lt;!-- Processes application requests --&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Example&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Example&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;!-- The definition of the Root Spring Container shared by all Servlets and Filters --&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/Example-servlet.xml,/WEB-INF/spring/mongo-config.xml,/WEB-INF/spring/spring-security.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;!-- Creates the Spring Container shared by all Servlets and Filters --&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
      &lt;listener&gt;
          &lt;listener-class&gt; org.springframework.security.web.session.HttpSessionEventPublisher&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;default&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.js&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;default&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.tag&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;hiddenHttpMethodFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;org.springframework.web.filter.HiddenHttpMethodFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;hiddenHttpMethodFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
          &lt;servlet-name&gt;Example&lt;/servlet-name&gt;
      &lt;/filter-mapping&gt;
      &lt;!-- Spring Security --&gt;
      &lt;filter&gt;  
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;  
          &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;  
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;session-config&gt;
          &lt;session-timeout&gt;60&lt;/session-timeout&gt;
      &lt;/session-config&gt;
  
      &lt;!-- hibernate --&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;hibernateFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;
              org.springframework.orm.hibernate4.support.OpenSessionInViewFilter
          &lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;sessionFactoryBeanName&lt;/param-name&gt;
              &lt;param-value&gt;sessionFactory&lt;/param-value&gt; 
          &lt;/init-param&gt;
      &lt;/filter&gt;
       &lt;filter-mapping&gt;
           &lt;filter-name&gt;hibernateFilter&lt;/filter-name&gt;
           &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
       &lt;/filter-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Server log</p>
  
  <pre><code>May 23, 2016 11:25:54 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
  WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:exampleDotCom' did not find a matching property.
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Server version:        Apache Tomcat/8.0.32
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Server built:          Feb 2 2016 19:34:53 UTC
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Server number:         8.0.32.0
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: OS Name:               Windows 8.1
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: OS Version:            6.3
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Architecture:          amd64
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Java Home:             C:\Program Files\Java\jre1.8.0_73
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: JVM Version:           1.8.0_73-b02
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: JVM Vendor:            Oracle Corporation
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: CATALINA_BASE:         C:\Users\abhiljain\Documents\personel\exampleWorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: CATALINA_HOME:         C:\Users\abhiljain\Documents\personel\software\apache-tomcat-8.0.32
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dcatalina.base=C:\Users\abhiljain\Documents\personel\exampleWorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dcatalina.home=C:\Users\abhiljain\Documents\personel\software\apache-tomcat-8.0.32
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dwtp.deploy=C:\Users\abhiljain\Documents\personel\exampleWorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Djava.endorsed.dirs=C:\Users\abhiljain\Documents\personel\software\apache-tomcat-8.0.32\endorsed
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dfile.encoding=Cp1252
  May 23, 2016 11:25:54 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
  INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_73\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_73/bin/server;C:/Program Files/Java/jre1.8.0_73/bin;C:/Program Files/Java/jre1.8.0_73/lib/amd64;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\TortoiseHg\;C:\Users\abhiljain\Documents\personel\software\apache-maven-3.2.1\apache-maven-3.2.1\bin;C:\dev\nodejs\;C:\dev\Android\sdk\tool;C:\dev\Android\sdk\platform-tools;C:\dev\nodejs;C:\Program Files\MongoDB\Server\3.0\bin;C:\Program Files (x86)\MySQL\MySQL Utilities 1.4\;C:\Program Files (x86)\MySQL\MySQL Utilities 1.4\Doctrine extensions for PHP\;C:\Program Files\Java\jdk1.8.0_73\bin;C:\Program Files\TortoiseGit\bin;C:\Users\abhiljain\Documents\personel\software\openssl-0.9.8k_WIN32\bin;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Brackets\command;C:\Program Files (x86)\Redis;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Users\abhiljain\AppData\Roaming\npm;C:\Users\abhiljain\Documents\personel\software\eclipse-luna-AndroidPlugin;;.
  May 23, 2016 11:25:54 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-nio-8080"]
  May 23, 2016 11:25:54 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
  INFO: Using a shared selector for servlet write/read
  May 23, 2016 11:25:54 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
  May 23, 2016 11:25:54 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
  INFO: Using a shared selector for servlet write/read
  May 23, 2016 11:25:54 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 1069 ms
  May 23, 2016 11:25:54 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  May 23, 2016 11:25:54 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/8.0.32
  May 23, 2016 11:26:04 PM org.apache.jasper.servlet.TldScanner scanJars
  INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
  May 23, 2016 11:26:04 PM org.apache.catalina.core.ApplicationContext log
  INFO: No Spring WebApplicationInitializer types detected on classpath
  May 23, 2016 11:26:04 PM org.apache.catalina.core.ApplicationContext log
  INFO: Initializing Spring root WebApplicationContext
  May 23, 2016 11:26:16 PM org.apache.catalina.core.ApplicationContext log
  INFO: Initializing Spring FrameworkServlet 'example'
  May 23, 2016 11:26:17 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-nio-8080"]
  May 23, 2016 11:26:17 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["ajp-nio-8009"]
  May 23, 2016 11:26:17 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 23571 ms
  May 23, 2016 11:26:19 PM org.apache.tomcat.util.http.LegacyCookieProcessor processCookieHeader
  INFO: Cookies: Invalid cookie. Value not a token or quoted value
   Note: further occurrences of Cookie errors will be logged at DEBUG level.
  </code></pre>