title: Tomcat application fails to start after adding CORS support
body: <p>I have a Tomcat 7 project which works like a charm on my Eclipse-integrated test server, but fails to start on the production server.</p>
  
  <p>It previously worked on production too, but I had to add CORS support, which somehow made it fail.</p>
  
  <p>To add CORS support, I added this to my pom.xml</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
    &lt;artifactId&gt;tomcat-catalina&lt;/artifactId&gt;
    &lt;version&gt;8.0.22&lt;/version&gt;
    &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>and this to my web.xml</p>
  
  <pre><code>&lt;filter&gt;
    &lt;filter-name&gt;CorsFilter&lt;/filter-name&gt;
    &lt;filter-class&gt;org.apache.catalina.filters.CorsFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
    &lt;filter-name&gt;CorsFilter&lt;/filter-name&gt;
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>If I remove these lines again, it works on the production server, but CORS doesn't work.</p>
  
  <p>The server throws a <code>ClassNotFoundException</code> when I try to start the application, which is strange, because the class is clearly there in the .war-file.</p>
  
  <p>The catalina log claims a few .jar-files fails to validate because "jar not loaded". The .jars are all in the .war, so I do not understand why it fails.</p>
  
  <p>Output from the logs:</p>
  
  <p>Catalina log:</p>
  
  <pre><code>May 19, 2015 9:10:29 AM org.apache.catalina.util.LifecycleBase stop
  INFO: The stop() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/APIMR]] after stop() had already been called. The second call will be ignored.
  May 19, 2015 9:10:29 AM org.apache.catalina.startup.HostConfig deleteRedeployResources
  INFO: Undeploying context [/APIMR]
  May 19, 2015 9:10:36 AM org.apache.catalina.startup.HostConfig deployWAR
  INFO: Deploying web application archive /var/lib/tomcat/webapps/APIMR.war
  May 19, 2015 9:10:37 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
  INFO: validateJarFile(/usr/share/tomcat/webapps/APIMR/WEB-INF/lib/tomcat-el-api-8.0.22.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class
  May 19, 2015 9:10:37 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
  INFO: validateJarFile(/usr/share/tomcat/webapps/APIMR/WEB-INF/lib/tomcat-servlet-api-8.0.22.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
  May 19, 2015 9:10:38 AM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Error filterStart
  May 19, 2015 9:10:38 AM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Context [/APIMR] startup failed due to previous errors
  </code></pre>
  
  <p>localhost log:</p>
  
  <pre><code>May 19, 2015 8:22:11 AM org.apache.catalina.core.ApplicationContext log
  INFO: Initializing Spring FrameworkServlet 'dispatcher'
  May 19, 2015 8:22:13 AM org.apache.catalina.core.ApplicationContext log
  INFO: ContextListener: contextInitialized()
  May 19, 2015 8:22:13 AM org.apache.catalina.core.ApplicationContext log
  INFO: SessionListener: contextInitialized()
  May 19, 2015 8:22:13 AM org.apache.catalina.core.ApplicationContext log
  INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@d45f6a5')
  May 19, 2015 9:10:05 AM org.apache.catalina.core.StandardContext filterStart
  SEVERE: Exception starting filter CorsFilter
  java.lang.ClassNotFoundException: org.apache.catalina.filters.CorsFilter
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      &lt;snip&gt;
  
  
  May 19, 2015 9:10:38 AM org.apache.catalina.core.StandardContext filterStart
  SEVERE: Exception starting filter CorsFilter
  java.lang.ClassNotFoundException: org.apache.catalina.filters.CorsFilter
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      &lt;snip&gt;
  </code></pre>
  
  <p>Any suggestions?</p>