title: mvn test leads to NoClassDefFoundError though it is in the class path
body: <p>some explanation on the project first. I'm building <a href="https://github.com/paulhoule/infovore/tree/v1.1.1" rel="nofollow">https://github.com/paulhoule/infovore/tree/v1.1.1</a> and having problems with maven. However this only happens on a Debian 3.2.57 machine, while it works on a Ubuntu 13.04 machine. This is why I'm not filing an issue with the related projects but would rather like to know ways to debug this.</p>
  
  <p>Several tests fail on  <code>mvn test</code> because of the same <code>ClassDefNotFoundError</code>. Some excerpts from the surefire reports:</p>
  
  <pre><code> &lt;error message="org/apache/xerces/xs/XSTypeDefinition" type="java.lang.NoClassDefFoundError"&gt;java.lang.NoClassDefFoundError: org/apache/xerces/xs/XSTypeDefinition
      at com.ontology2.millipede.triples.PartitionOnSubjectTTest.testBin(PartitionOnSubjectTTest.java:35)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  
  java.lang.NoClassDefFoundError: org/apache/xerces/xs/XSTypeDefinition
      at com.hp.hpl.jena.n3.turtle.ParserBase.&lt;init&gt;(ParserBase.java:25)
      at com.ontology2.rdf.parser.NodeParser.&lt;init&gt;(NodeParser.java:337)
  </code></pre>
  
  <p>However the corresponding jar is in the classpath as <code>mvn test -X</code> shows:</p>
  
  <pre><code>[DEBUG] test classpath classpath:
  [DEBUG]   /home/semmul2/tools/infovore-1.1/millipede/target/test-classes
  [DEBUG]   /home/semmul2/tools/infovore-1.1/millipede/target/classes
  [DEBUG]   /home/semmul2/.m2/repository/junit/junit/4.11/junit-4.11.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
  [DEBUG]   /home/semmul2/.m2/repository/com/google/guava/guava/14.0.1/guava-14.0.1.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/springframework/spring-context/3.2.1.RELEASE/spring-context-3.2.1.RELEASE.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/springframework/spring-beans/3.2.1.RELEASE/spring-beans-3.2.1.RELEASE.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/springframework/spring-aop/3.2.1.RELEASE/spring-aop-3.2.1.RELEASE.jar
  [DEBUG]   /home/semmul2/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/springframework/spring-expression/3.2.1.RELEASE/spring-expression-3.2.1.RELEASE.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/springframework/spring-core/3.2.1.RELEASE/spring-core-3.2.1.RELEASE.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/apache/jena/jena-arq/2.9.3/jena-arq-2.9.3.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/apache/jena/jena-core/2.7.3/jena-core-2.7.3.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/apache/jena/jena-iri/0.9.3/jena-iri-0.9.3.jar
  --&gt; [DEBUG]   /home/semmul2/.m2/repository/xerces/xercesImpl/2.10.0/xercesImpl-2.10.0.jar**
  [DEBUG]   /home/semmul2/.m2/repository/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar
  [DEBUG]   /home/semmul2/.m2/repository/commons-codec/commons-codec/1.5/commons-codec-1.5.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/apache/httpcomponents/httpcore/4.1.3/httpcore-4.1.3.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.jar
  [DEBUG]   /home/semmul2/.m2/repository/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar
  [DEBUG]   /home/semmul2/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar
  [DEBUG]   /home/semmul2/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
  </code></pre>
  
  <p>And a look in the corresponding jar reveals that the class is indeed in there: </p>
  
  <pre><code>jar tf  /home/semmul2/.m2/repository/xerces/xercesImpl/2.10.0/xercesImpl-2.10.0.jar | grep XSTypeDefinition
  &gt;&gt; org/apache/xerces/xs/XSTypeDefinition.
  </code></pre>
  
  <p>The corresponding pom.xml looks like this:</p>
  
  <pre><code>&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/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;parent&gt;
      &lt;artifactId&gt;infovore&lt;/artifactId&gt;
      &lt;groupId&gt;com.ontology2&lt;/groupId&gt;
      &lt;version&gt;1.1-SNAPSHOT&lt;/version&gt;
    &lt;/parent&gt;
  
    &lt;groupId&gt;com.ontology2&lt;/groupId&gt;
    &lt;artifactId&gt;millipede&lt;/artifactId&gt;
    &lt;version&gt;1.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
  
    &lt;name&gt;millipede&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;/properties&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;4.11&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
          &lt;artifactId&gt;guava&lt;/artifactId&gt;
          &lt;version&gt;14.0.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
          &lt;version&gt;3.2.1.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.jena&lt;/groupId&gt;
        &lt;artifactId&gt;jena-arq&lt;/artifactId&gt;
        &lt;version&gt;2.9.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;commons-logging&lt;/groupId&gt;
        &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
        &lt;version&gt;1.1.1&lt;/version&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>After a suggestion from Rob Hall I've also tried putting one of the failing tests into the jar and executing the test code as a main function. This is the result:</p>
  
  <pre><code>java -cp millipede-1.1-SNAPSHOT.jar com.ontology2.rdf.parser.NodeParserTest
  Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/xs/XSTypeDefinition
          at com.hp.hpl.jena.n3.turtle.ParserBase.&lt;init&gt;(ParserBase.java:25)
          at com.ontology2.rdf.parser.NodeParser.&lt;init&gt;(NodeParser.java:337)
          at com.ontology2.rdf.parser.NodeParserTest.main(NodeParserTest.java:18)
  Caused by: java.lang.ClassNotFoundException: org.apache.xerces.xs.XSTypeDefinition
          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)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
          ... 3 more
  </code></pre>
  
  <p>I've already tried:</p>
  
  <ul>
  <li><p>Removing the complete local repository to avoid conflicts with other projects</p></li>
  <li><p>Explicitly adding the xerces dependency</p></li>
  <li><p>Compared the maven and java versions as well as environment variables to the working machine</p></li>
  </ul>
  
  <p>Any other ideas are much appreciated! :) </p>