title: Spring Filter ClassCastException when running project on Tomcat
body: <p>I am getting following error when I try to run my project on Tomcat. It was working before but I updgraded jackson version to 1.9.13 from 1.9.7 and I was not able to run the project anymore after updating maven dependencies. I tried to downgrade Jackson to 1.9.7 but no chance.</p>
  
  <pre><code>SEVERE: Exception starting filter txTrackFilter
  java.lang.ClassCastException: org.springframework.web.filter.DelegatingFilterProxy cannot be cast to javax.servlet.Filter
  at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
  at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
  at org.apache.catalina.core.ApplicationFilterConfig.&lt;init&gt;(ApplicationFilterConfig.java:115)
  at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)
  at org.apache.catalina.core.StandardContext.start(StandardContext.java:4651)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
  at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
  at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
  at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
  at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)
  at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)
  at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
  at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
  at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
  at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
  at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
  at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
  at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
  at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
  Aug 3, 2014 12:11:02 AM org.apache.catalina.core.StandardContext start
  SEVERE: Error filterStart
  </code></pre>
  
  <p>I have checked all answers related to this problem. They all say that I need to define scope as provided and I already have. Here is my servlet-api dependency definition. </p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
      &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
      &lt;version&gt;3.1.0&lt;/version&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>I can't find any servlet-api dependency under any of dependency in my pom.xml. Here is all my pom.xml.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.stg&lt;/groupId&gt;
  &lt;artifactId&gt;stg&lt;/artifactId&gt;
  &lt;name&gt;STG&lt;/name&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;1.0.0-BUILD-SNAPSHOT&lt;/version&gt;
  &lt;properties&gt;
      &lt;java-version&gt;1.6&lt;/java-version&gt;
      &lt;org.springframework-version&gt;3.1.1.RELEASE&lt;/org.springframework-version&gt;
      &lt;org.aspectj-version&gt;1.6.10&lt;/org.aspectj-version&gt;
      &lt;org.slf4j-version&gt;1.6.6&lt;/org.slf4j-version&gt;
      &lt;hibernate.version&gt;4.1.6.Final&lt;/hibernate.version&gt;
      &lt;jackson.version&gt;1.9.13&lt;/jackson.version&gt;
  &lt;/properties&gt;
  &lt;dependencies&gt;
      &lt;!-- Spring --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework-version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;!-- Exclude Commons Logging in favor of SLF4j --&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                  &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- Hibernate --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;${hibernate.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Jackson --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
          &lt;version&gt;${jackson.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Others --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
          &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
          &lt;version&gt;1.4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;version&gt;5.1.25&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- AspectJ --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
          &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
          &lt;version&gt;${org.aspectj-version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Logging --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;version&gt;${org.slf4j-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
          &lt;version&gt;${org.slf4j-version}&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
          &lt;version&gt;${org.slf4j-version}&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.15&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;javax.mail&lt;/groupId&gt;
                  &lt;artifactId&gt;mail&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;javax.jms&lt;/groupId&gt;
                  &lt;artifactId&gt;jms&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;com.sun.jdmk&lt;/groupId&gt;
                  &lt;artifactId&gt;jmxtools&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;com.sun.jmx&lt;/groupId&gt;
                  &lt;artifactId&gt;jmxri&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- @Inject --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.inject&lt;/groupId&gt;
          &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
          &lt;version&gt;1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Servlet --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
          &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Test --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.7&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
          &lt;artifactId&gt;httpcore&lt;/artifactId&gt;
          &lt;version&gt;4.3.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
          &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
          &lt;version&gt;3.3.2&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;commons-codec&lt;/groupId&gt;
          &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
          &lt;version&gt;1.6&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-batch&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.RELEASE&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.codehaus.jettison&lt;/groupId&gt;
                  &lt;artifactId&gt;jettison&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-eclipse-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.9&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;additionalProjectnatures&gt;
                      &lt;projectnature&gt;org.springframework.ide.eclipse.core.springnature&lt;/projectnature&gt;
                  &lt;/additionalProjectnatures&gt;
                  &lt;additionalBuildcommands&gt;
                      &lt;buildcommand&gt;org.springframework.ide.eclipse.core.springbuilder&lt;/buildcommand&gt;
                  &lt;/additionalBuildcommands&gt;
                  &lt;downloadSources&gt;true&lt;/downloadSources&gt;
                  &lt;downloadJavadocs&gt;true&lt;/downloadJavadocs&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
                  &lt;compilerArgument&gt;-Xlint:all&lt;/compilerArgument&gt;
                  &lt;showWarnings&gt;true&lt;/showWarnings&gt;
                  &lt;showDeprecation&gt;true&lt;/showDeprecation&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.2.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;mainClass&gt;org.test.int1.Main&lt;/mainClass&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is mvn dependency:tree of my project.</p>
  
  <pre><code>[INFO] +- org.springframework:spring-context:jar:3.1.1.RELEASE:compile
  [INFO] |  +- org.springframework:spring-aop:jar:3.1.1.RELEASE:compile
  [INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
  [INFO] |  +- org.springframework:spring-beans:jar:3.1.1.RELEASE:compile
  [INFO] |  +- org.springframework:spring-core:jar:3.1.1.RELEASE:compile
  [INFO] |  +- org.springframework:spring-expression:jar:3.1.1.RELEASE:compile
  [INFO] |  \- org.springframework:spring-asm:jar:3.1.1.RELEASE:compile
  [INFO] +- org.springframework:spring-webmvc:jar:3.1.1.RELEASE:compile
  [INFO] |  +- org.springframework:spring-context-support:jar:3.1.1.RELEASE:compile
  [INFO] |  \- org.springframework:spring-web:jar:3.1.1.RELEASE:compile
  [INFO] +- org.springframework:spring-orm:jar:3.1.1.RELEASE:compile
  [INFO] |  +- org.springframework:spring-jdbc:jar:3.1.1.RELEASE:compile
  [INFO] |  \- org.springframework:spring-tx:jar:3.1.1.RELEASE:compile
  [INFO] +- org.hibernate:hibernate-entitymanager:jar:4.1.6.Final:compile
  [INFO] |  +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
  [INFO] |  +- org.hibernate:hibernate-core:jar:4.1.6.Final:compile
  [INFO] |  |  \- antlr:antlr:jar:2.7.7:compile
  [INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
  [INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
  [INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
  [INFO] |  +- org.javassist:javassist:jar:3.15.0-GA:compile
  [INFO] |  \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
  [INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
  [INFO] |  \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
  [INFO] +- commons-dbcp:commons-dbcp:jar:1.4:compile
  [INFO] |  \- commons-pool:commons-pool:jar:1.5.4:compile
  [INFO] +- mysql:mysql-connector-java:jar:5.1.25:compile
  [INFO] +- org.aspectj:aspectjrt:jar:1.6.10:compile
  [INFO] +- org.slf4j:slf4j-api:jar:1.6.6:compile
  [INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.6:runtime (scope not updated to compile)
  [INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.6:runtime
  [INFO] +- log4j:log4j:jar:1.2.15:runtime
  [INFO] +- javax.inject:javax.inject:jar:1:compile
  [INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
  [INFO] +- junit:junit:jar:4.7:test
  [INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.0.0.RELEASE:compile
  [INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.0.0.RELEASE:compile
  [INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.7.4:compile
  [INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.0.0.RELEASE:compile
  [INFO] |  |  \- org.apache.tomcat:tomcat-jdbc:jar:7.0.52:compile
  [INFO] |  |     \- org.apache.tomcat:tomcat-juli:jar:7.0.52:compile
  [INFO] |  +- org.springframework.data:spring-data-jpa:jar:1.5.1.RELEASE:compile
  [INFO] |  |  \- org.springframework.data:spring-data-commons:jar:1.7.1.RELEASE:compile
  [INFO] |  \- org.springframework:spring-aspects:jar:4.0.3.RELEASE:compile
  [INFO] +- org.apache.httpcomponents:httpcore:jar:4.3.1:compile
  [INFO] +- org.apache.commons:commons-lang3:jar:3.3.2:compile
  [INFO] +- commons-codec:commons-codec:jar:1.6:compile
  [INFO] +- org.springframework.boot:spring-boot-starter-batch:jar:1.0.0.RELEASE:compile
  [INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.0.0.RELEASE:compile
  [INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.0.0.RELEASE:compile
  [INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.0.0.RELEASE:compile
  [INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.0.0.RELEASE:compile
  [INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.6:compile
  [INFO] |  |  |  +- org.slf4j:log4j-over-slf4j:jar:1.7.6:compile
  [INFO] |  |  |  \- ch.qos.logback:logback-classic:jar:1.1.1:compile
  [INFO] |  |  |     \- ch.qos.logback:logback-core:jar:1.1.1:compile
  [INFO] |  |  \- org.yaml:snakeyaml:jar:1.13:runtime
  [INFO] |  +- org.hsqldb:hsqldb:jar:2.3.2:compile
  [INFO] |  \- org.springframework.batch:spring-batch-core:jar:2.2.5.RELEASE:compile
  [INFO] |     +- org.springframework.batch:spring-batch-infrastructure:jar:2.2.5.RELEASE:compile
  [INFO] |     |  \- org.springframework.retry:spring-retry:jar:1.0.2.RELEASE:compile
  [INFO] |     \- com.thoughtworks.xstream:xstream:jar:1.3:compile
  [INFO] |        \- xpp3:xpp3_min:jar:1.1.4c:compile
  [INFO] \- org.springframework.boot:spring-boot-starter-web:jar:1.0.0.RELEASE:compile
  [INFO]    +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.0.0.RELEASE:compile
  [INFO]    |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.52:compile
  [INFO]    |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:7.0.52:compile
  [INFO]    |  \- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:7.0.52:compile
  [INFO]    \- com.fasterxml.jackson.core:jackson-databind:jar:2.3.2:compile
  [INFO]       +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
  [INFO]       \- com.fasterxml.jackson.core:jackson-core:jar:2.3.2:compile
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p>I spent several hours on this problem but I got stuck. Even if I disable filtering, I am getting another class cast exception related to this servlet-api scope problem. But I can't find any servlet-api jar.
  Any help is highly appreciated.</p>
  
  <p>Thanks in advance.</p>