title: java.lang.NoClassDefFoundError while deploying a war file that was created by maven overlay
body: <p>I've built by Maven a war file that uses other <strong>war overlays</strong> as dependencies...
  The built was successful.</p>
  
  <p>But while deploying to Jboss I get the following error:</p>
  
  <pre><code>11:27:49,054 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-1) .... nested exception is java.lang.NoClassDefFoundError: org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor
          at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:281) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
          at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
          ........
  </code></pre>
  
  <p>So I've got <code>java.lang.NoClassDefFoundError</code> for class <code>AnnotationMetadataReadingVisitor</code>... based on the exception, I assume that the class appears more than once on the classpath.</p>
  
  <p>I've verified that <code>org.springframework.core.type.classreading.AnnotationMetadataReadingVisitor</code> does exist on the classpath (in the war file it's in <code>WEB-INF\lib\spring-core-3.2.1.RELEASE.jar</code>).</p>
  
  <p>But as far as I can see it's the only jar on my classpath that contains that class.</p>
  
  <p>Any idea what I am missing here?</p>
  
  <p>Here is the full content of the <code>WEB-INF\lib</code> of the war I'm trying to deploy:</p>
  
  <pre><code>activemq-all-5.5.1.jar
  ant-1.7.0.jar
  ant-launcher-1.7.0.jar
  antlr-2.7.7.jar
  antlr-3.3.jar
  antlr-runtime-3.3.jar
  aopalliance-1.0.jar
  aspectjweaver-1.7.1.jar
  axiom-api-1.2.12.jar
  axiom-dom-1.2.12.jar
  axiom-impl-1.2.12.jar
  axis2-1.6.1.jar
  axis2-adb-1.6.1.jar
  axis2-adb-codegen-1.6.1.jar
  axis2-ant-plugin-1.6.1.jar
  axis2-clustering-1.6.1.jar
  axis2-codegen-1.6.1.jar
  axis2-corba-1.6.1.jar
  axis2-fastinfoset-1.6.1.jar
  axis2-java2wsdl-1.6.1.jar
  axis2-jaxbri-1.6.1.jar
  axis2-jaxws-1.6.1.jar
  axis2-jibx-1.6.1.jar
  axis2-json-1.6.1.jar
  axis2-kernel-1.6.1.jar
  axis2-metadata-1.6.1.jar
  axis2-mtompolicy-1.6.1.jar
  axis2-saaj-1.6.1.jar
  axis2-transport-http-1.6.1.jar
  axis2-transport-local-1.6.1.jar
  axis2-xmlbeans-1.6.1.jar
  bcel-5.1.jar
  blitzer-1.0.9.jar
  c3p0-0.9.1.1.jar
  camel-core-2.4.0.jar
  camel-xstream-2.4.0.jar
  cdjai-1.0.jar
  commons-beanutils-1.7.0.jar
  commons-cli-1.2.jar
  commons-codec-1.3.jar
  commons-collections-3.1.jar
  commons-dbcp-1.4.jar
  commons-digester-1.8.jar
  commons-fileupload-1.2.1.jar
  commons-httpclient-3.1.jar
  commons-io-1.3.2.jar
  commons-lang-2.5.jar
  commons-logging-1.1.1.jar
  commons-logging-api-1.1.jar
  commons-management-1.0.jar
  commons-net-3.1.jar
  commons-pool-1.5.4.jar
  displaytag-1.2.jar
  displaytag-export-poi-1.2.jar
  drools-compiler-5.3.0.Final.jar
  drools-core-5.3.0.Final.jar
  ecj-3.5.1.jar
  el-api-2.2.jar
  el-impl-2.2.jar
  FastInfoset-1.2.7.jar
  freemarker-2.3.13.jar
  geronimo-activation_1.1_spec-1.0.2.jar
  geronimo-annotation_1.0_spec-1.1.jar
  geronimo-javamail_1.4_spec-1.6.jar
  geronimo-jaxws_2.2_spec-1.0.jar
  geronimo-jta_1.1_spec-1.1.jar
  geronimo-saaj_1.3_spec-1.0.1.jar
  geronimo-stax-api_1.0_spec-1.0.1.jar
  geronimo-ws-metadata_2.0_spec-1.1.2.jar
  httpcore-4.0.jar
  itext-1.3.jar
  javaee-api-5.0-2.jar
  javax.inject-1.jar
  jaxb-api-2.1.jar
  jaxb-impl-2.1.7.jar
  jaxb-xjc-2.1.7.jar
  jaxen-1.1.1.jar
  jaxws-tools-2.1.3.jar
  jboss-j2se-200504122039.jar
  jcl104-over-slf4j-1.4.2.jar
  jettison-1.2.jar
  jibx-bind-1.2.jar
  jibx-run-1.2.jar
  jsp-api-2.1.jar
  jsr311-api-1.0.jar
  jta-1.1.jar
  juli-6.0.16.jar
  junit-4.8.2.jar
  knowledge-api-5.3.0.Final.jar
  log4j-1.2.16.jar
  mvel2-2.1.0.drools4.jar
  neethi-2.0.1.jar
  ognl-2.6.11.jar
  ojdbc14-10.2.0.3.0.jar
  p-my-web-app-legacy-1.0-SNAPSHOT-classes.jar
  poi-3.2-FINAL.jar
  primefaces-3.4.2.jar
  quartz-2.0.2.jar
  regexp-1.2.jar
  servlet-api-2.5.jar
  slf4j-api-1.6.1.jar
  slf4j-log4j12-1.4.2.jar
  spring-aop-3.2.1.RELEASE.jar
  spring-asm-3.1.4.RELEASE.jar
  spring-aspects-3.2.1.RELEASE.jar
  spring-beans-3.2.1.RELEASE.jar
  spring-context-3.2.1.RELEASE.jar
  spring-context-support-3.2.1.RELEASE.jar
  spring-core-3.2.1.RELEASE.jar
  spring-expression-3.2.1.RELEASE.jar
  spring-instrument-3.2.1.RELEASE.jar
  spring-jdbc-3.2.1.RELEASE.jar
  spring-jms-3.2.1.RELEASE.jar
  spring-orm-3.2.1.RELEASE.jar
  spring-oxm-3.2.1.RELEASE.jar
  spring-test-3.2.1.RELEASE.jar
  spring-tx-3.2.1.RELEASE.jar
  spring-web-3.2.1.RELEASE.jar
  spring-webmvc-3.2.1.RELEASE.jar
  standard-1.0.6.jar
  stax-api-1.0.1.jar
  stax2-api-3.0.1.jar
  stringtemplate-3.2.1.jar
  struts2-core-2.1.6.jar
  struts2-dojo-plugin-2.2.3.1.jar
  struts2-tiles-plugin-2.1.6.jar
  tiles-api-2.0.6.jar
  tiles-core-2.0.6.jar
  tiles-jsp-2.0.6.jar
  tiles-servlet-2.1.2.jar
  tribes-6.0.16.jar
  woden-api-1.0M9.jar
  woden-impl-commons-1.0M9.jar
  woden-impl-dom-1.0M9.jar
  woodstox-core-asl-4.0.7.jar
  wsdl4j-1.6.2.jar
  wstx-asl-3.2.9.jar
  xalan-2.7.0.jar
  xml-resolver-1.2.jar
  xmlbeans-2.3.0.jar
  XmlSchema-1.4.7.jar
  xpp3_min-1.1.4c.jar
  xstream-1.3.1.jar
  xwork-2.1.2.jar
  </code></pre>