title: Tomcat 7.0.29 servlet-api classloader issue
body: <p>I'm currently trying to change our build from a manual process (MyEclipse / export as war) to an automatic Maven Build.</p>
  
  <p>The war application built by MyEclipse deploys and works just fine on our Tomcat 7.0.29 installation (Windows 7).  In the MyEclipse build path, we have configured a user library (tomcat), which contains all jars from <code>$CATALINA_HOME/lib</code>.</p>
  
  <p>We have some servlet listeners and filters that use javax.servlet.http.* classes (HttpSessionEvent etc).  They are packaged under <code>WEB-INF\classes\com\mycompany\filters</code> </p>
  
  <p>When deploying the war built by Maven I get <code>NoClassDefFoundError</code> on the <code>HttpSessionEvent</code> class.  I did a trace with -verbose:class JVM option and I saw that the last class loaded is my filter from the 
  <code>c:\apache\webapps\myapp\WEB-INF\classes\com\mycompany\filters</code> directory.  I then tries to load / find HttpSessionEvent and is unable to do so. </p>
  
  <p>The <code>servlet-api.jar</code> is of course in my <code>$CATALINA_HOME\lib</code> directory.</p>
  
  <p>In my pom.xml I have this dependency</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
          &lt;artifactId&gt;tomcat-servlet-api&lt;/artifactId&gt;
          &lt;version&gt;7.0.29&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I have no other servlet-api.jar files anywhere in my path / classpath (doublechecked the lib/ext and endorsed directories of my jdk and jre as well)</p>
  
  <p>My maven dependency:tree looks like this : </p>
  
  <pre><code>[INFO] +- log4j:log4j:jar:1.2.15:compile
  [INFO] |  \- javax.mail:mail:jar:1.4:compile
  [INFO] +- jstl:jstl:jar:1.2:compile
  [INFO] +- org.jdom:jdom:jar:1.1:provided
  [INFO] +- com.sun.xml.rpc:jaxrpc-impl:jar:1.1.3_01:provided
  [INFO] |  +- javax.xml:jaxrpc-api:jar:1.1:provided
  [INFO] |  +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.3:provided
  [INFO] |  |  \- javax.xml.soap:saaj-api:jar:1.3:provided
  [INFO] |  +- com.sun.xml.rpc:jaxrpc-spi:jar:1.1.3_01:provided
  [INFO] |  \- com.sun.xml.fastinfoset:FastInfoset:jar:1.0.2:provided
  [INFO] +- org.apache.lucene:lucene-core:jar:3.6.0:compile
  [INFO] +- org.springframework:spring-context:jar:3.1.0.RELEASE:compile
  [INFO] |  +- org.springframework:spring-beans:jar:3.1.0.RELEASE:compile
  [INFO] |  +- org.springframework:spring-core:jar:3.1.0.RELEASE:compile
  [INFO] |  |  \- commons-logging:commons-logging:jar:1.1.1:compile
  [INFO] |  +- org.springframework:spring-expression:jar:3.1.0.RELEASE:compile
  [INFO] |  \- org.springframework:spring-asm:jar:3.1.0.RELEASE:compile
  [INFO] +- org.springframework:spring-web:jar:3.1.0.RELEASE:compile
  [INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
  [INFO] +- org.springframework:spring-orm:jar:3.1.0.RELEASE:compile
  [INFO] |  +- org.springframework:spring-jdbc:jar:3.1.0.RELEASE:compile
  [INFO] |  \- org.springframework:spring-tx:jar:3.1.0.RELEASE:compile
  [INFO] +- org.springframework:spring-aop:jar:3.1.0.RELEASE:compile
  [INFO] +- org.springframework:spring-test:jar:3.1.0.RELEASE:test
  [INFO] +- org.aspectj:aspectjrt:jar:1.7.1:compile
  [INFO] +- org.aspectj:aspectjweaver:jar:1.7.1:compile
  [INFO] +- javax.faces:javax.faces-api:jar:2.1:compile
  [INFO] +- com.sun.faces:jsf-impl:jar:2.1.15:compile
  [INFO] +- org.primefaces:primefaces:jar:3.4.2:compile
  [INFO] +- org.richfaces.core:richfaces-core-api:jar:4.2.3.Final:compile
  [INFO] |  \- com.google.guava:guava:jar:11.0.2:compile
  [INFO] |     \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
  [INFO] +- org.richfaces.ui:richfaces-components-ui:jar:4.2.3.Final:compile
  [INFO] |  \- org.richfaces.ui:richfaces-components-api:jar:4.2.3.Final:compile
  [INFO] +- org.apache.tomcat:tomcat-servlet-api:jar:7.0.29:provided
  [INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.2:compile
  [INFO] |  \- org.slf4j:slf4j-api:jar:1.7.2:compile
  [INFO] +- org.hibernate:hibernate-core:jar:3.6.2.Final:compile
  [INFO] |  +- antlr:antlr:jar:2.7.6:compile
  [INFO] |  +- commons-collections:commons-collections:jar:3.1:compile
  [INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
  [INFO] |  +- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
  [INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
  [INFO] |  \- javax.transaction:jta:jar:1.1:compile
  [INFO] +- org.hibernate:hibernate-entitymanager:jar:3.6.2.Final:compile
  [INFO] |  +- cglib:cglib:jar:2.2:compile
  [INFO] |  |  \- asm:asm:jar:3.1:compile
  [INFO] |  \- javassist:javassist:jar:3.12.0.GA:compile
  [INFO] +- org.hibernate:hibernate-validator:jar:4.1.0.Final:compile
  [INFO] |  \- javax.validation:validation-api:jar:1.0.0.GA:compile
  [INFO] +- org.apache.commons:commons-email:jar:1.2:compile
  [INFO] |  \- javax.activation:activation:jar:1.1:compile
  [INFO] +- junit:junit:jar:4.11:test
  [INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
  [INFO] \- com.h2database:h2:jar:1.3.170:test
  </code></pre>
  
  <p>I've been searching on this for a while on the internet, and from what I've read this must have something to do with the tomcat classloader.  Very probably there's something wrong with the packaging of my war.  However, I haven't found a solution yet.</p>
  
  <p>Any pointers will be much appreciated!</p>