title: MonitorFilter::WARNING: the monitor filter must be the first filter in the chain
body: <p>The Tomcat server logs the following warning on the server terminal while accessing pages from the browser after upgrading Tomcat from 8.0.5 to 8.0.9.0.</p>
  
  <pre><code>MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  WARNING *********** NetBeans HTTP Monitor ************
  The request cannot be recorded most likely because the NetBeans HTTP Monitor module is disabled.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  MonitorFilter::WARNING: the monitor filter must be the first filter in the chain.
  </code></pre>
  
  <p>The relevant software : </p>
  
  <ul>
  <li>Spring 4.0.0 GA</li>
  <li>Spring Security 3.2.0 GA.</li>
  <li>JSF 2.2.8-02</li>
  <li>PrimeFaces 5.1 final</li>
  <li>PrimeFaces Extension 2.1.0</li>
  <li>JDK 8u25</li>
  <li>NetBeans 8.0.1</li>
  </ul>
  
  <p>The web.xml file : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" 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_3_0.xsd"&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
              /WEB-INF/applicationContext.xml
              /WEB-INF/spring-security.xml
          &lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.FACELETS_LIBRARIES&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/my.taglib.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt;
          &lt;param-value&gt;Production&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
          &lt;param-value&gt;server&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;log4jConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/log4j.properties&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;log4jExposeWebAppRoot&lt;/param-name&gt;
          &lt;param-value&gt;false&lt;/param-value&gt;
      &lt;/context-param&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;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
          &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
      &lt;/filter-mapping&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;loginNocacheFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;filter.LoginNocacheFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;loginNocacheFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/utility/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;NoCacheFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;filter.NoCacheFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;NoCacheFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/admin_side/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&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.web.context.request.RequestContextListener
          &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;listener&gt;
          &lt;listener-class&gt;
              org.springframework.web.util.Log4jConfigListener
          &lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;PrimeFaces FileUpload Filter&lt;/filter-name&gt;
          &lt;filter-class&gt;
              org.primefaces.webapp.filter.FileUploadFilter
          &lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;PrimeFaces FileUpload Filter&lt;/filter-name&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;/filter-mapping&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&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;Faces Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;security-constraint&gt;
          &lt;display-name&gt;Restrict direct access to XHTML files&lt;/display-name&gt;
          &lt;web-resource-collection&gt;
              &lt;web-resource-name&gt;XHTML files&lt;/web-resource-name&gt;
              &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt;
          &lt;/web-resource-collection&gt;
          &lt;auth-constraint/&gt;
      &lt;/security-constraint&gt;
      &lt;session-config&gt;
          &lt;session-timeout&gt;
              120
          &lt;/session-timeout&gt;
      &lt;/session-config&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;/utility/Login.jsf&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
          &lt;resource-ref&gt;
          &lt;res-ref-name&gt;jdbc/social_networking&lt;/res-ref-name&gt;
          &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
          &lt;res-auth&gt;Container&lt;/res-auth&gt;
      &lt;/resource-ref&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>This did not happen in the previous Tomcat server (8.0.5). Is there a fix?</p>
  
  <p>Note : In my <a href="https://stackoverflow.com/q/14518003/1391249">previous question</a> (a year ago), I disabled the HTTP monitor to just suppress the warning. It was not a solution.</p>
  
  <p><sub><strong>EDIT :</strong> I forgot to mention but it is clear that this warning appears after <code>Filter</code>s pertaining to Spring Security are registered in web.xml.</sub></p>