title: ClassNotFoundException after instrumenting with cobertura
body: <p>Using JBoss AS 7.1.1 I want to get code coverage after testing of my project, deployed as an .war.</p>
  
  <p>It seemingly works as expected until the point where I am starting the server. Here is the error message:</p>
  
  <blockquote>
    <p>13:20:49,571 SEVERE [net.sourceforge.cobertura.coveragedata.TouchCollector] (MSC service thread 1-8) Exception when registering class: com/project/Creator: java.lang.ClassNotFoundException: com.project.Creator from [Module "org.jboss.as.server:main" from local module loader @30c01f1c (roots: C:\Jboss\jboss-as-7.1.1.Final\modules)]<br>
            at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]<br>
            at </p>
  </blockquote>
  
  <p>An important part may be that without using <code>--auxClasspath</code> argument, I did get errors instrumenting this class because of dependencies. This should be fixed by the mentioned argument though.</p>
  
  <p>Edit:</p>
  
  <p>There are in two situations where I get problems.</p>
  
  <p>During instrumentation, using the following command for instrumentation</p>
  
  <blockquote>
    <p>C:\cobertura\cobertura-2.0.3\cobertura-instrument.bat" --basedir C:\Jboss\jboss-as-7.1.1.Final\standalone\deployments project.war --datafile C:\Jboss\jboss-as-7.1.1.Final\bin\cobertura.ser --auxClasspath ""C:\workspace\jboss-build\src\com\arbitrage\j2ee\common\dto\TypeData.java</p>
  </blockquote>
  
  <p>which gives me the error</p>
  
  <blockquote>
    <p>java.lang.RuntimeException: java.lang.ClassNotFoundException: com.arbitrage.j2ee.common.dto.TypeData
        at net.sourceforge.cobertura.instrument.CoberturaClassWriter.getCommonSuperClass(CoberturaClassWriter.java:35)</p>
  </blockquote>
  
  <p>But, when I start up JBoss, it does so without giving any errors.</p>
  
  <p>However, when I stop JBoss I get this error:</p>
  
  <blockquote>
    <p>ERROR [stderr] Exception in thread "Thread-45" java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/TouchCollector$ApplyToClassDataLightClassmapListener</p>
  </blockquote>
  
  <p>In the second case instrumentation goes well with the following command</p>
  
  <blockquote>
    <p>C:\cobertura\cobertura-2.0.3\cobertura-instrument.bat" addInstrumentationToArchive C:\Jboss\jboss-as-7.1.1.Final\standalone\deployments\screator.war --includeClasses "com.project.*" --datafile C:\Jboss\jboss-as-7.1.1.Final\bin\cobertura.ser --auxClasspath "C:.m2\repository\com\project\1\project-1.jar</p>
  </blockquote>
  
  <p>Which gives me an OK</p>
  
  <blockquote>
    <p>INFO: Cobertura: Saved information on 41 classes.</p>
  </blockquote>
  
  <p>Now the problem occurs when starting up JBoss</p>
  
  <blockquote>
    <p>SEVERE net.sourceforge.cobertura.coveragedata.TouchCollector Exception when registering class: com/project/Creator: java.lang.ClassNotFoundException: com.project.Creator from [Module "org.jboss.as.server:main" from local module loader @30c01f1 (roots: C:\Jboss\jboss-as-7.1.1.Final\modules)]. </p>
  </blockquote>
  
  <p>etc etc.</p>
  
  <p>I have added <code>-Djboss.shutdown.forceHalt=false</code> to the VM arguments.</p>
  
  <p>Help is much appreciated,
  Thanks!</p>