running "mvn verify" fails

Issue #366 resolved
Oscar Scholten created an issue

Hi,

When I run "mvn verify", one test fails, likely due to one of the Cobertura plugins. I get the following output on the commandline:

[INFO] Cobertura: Loaded information on 201 classes.
[INFO] Cobertura: Saved information on 201 classes.

Results :

Tests in error:
  ContextClassLoaderTest.domainInDifferentConstructor:125 » NoClassDefFound net/...

Tests run: 861, Failures: 0, Errors: 1, Skipped: 0

And in IntelliJ:

java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/TouchCollector

    at org.yaml.snakeyaml.Yaml.__cobertura_init(Yaml.java)
    at org.yaml.snakeyaml.Yaml.<clinit>(Yaml.java)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.yaml.snakeyaml.issues.issue318.ContextClassLoaderTest.domainInDifferentConstructor(ContextClassLoaderTest.java:125)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.TouchCollector
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 37 more

When I disable the plugin in the main pom.xml found on lines 170-197 it all works fine.

I don't know this plugin so I am afraid I cannot be of much help in figuring out a solution but am happy to try a fix on my machine.

Using: - SnakeYaml 1.19-SNAPSHOT - MacOS 10.12.3 - Java 1.8.0_102 - Maven 3.3.9 - IntelliJ 2016.3.4

Let me know if I can be of help.

Cheers, Oscar

Comments (9)

  1. Oscar Scholten reporter

    One thing I noticed (but did not experiment much with) is that two versions of the plugin are used, both a 2.6 version and a 2.7 one.

    I've upgraded to version 1.8.0_121-b13, problem remains.

    I've also tried Java 7 (1.7.0_75-b13), problem also occurs.

  2. Oscar Scholten reporter

    Perhaps introduce a profile that enables profiling? In other words, running mvn clean verify would not do the profiling (and succeed), running mvn clean verify -P profiling would do the profiling (and succeed I hope on your machine but fail here).

  3. Andrey Somov

    I fixed the version - it is defined only once. But it does not help, both 2.6 and 2.7 fail the same way.

  4. Andrey Somov

    The problem does not happen with the JDK 6 (see below) and with JDK 8 ( 1.8.0_144)

    Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
    Maven home: /usr/share/maven
    Java version: 1.6.0_34, vendor: Sun Microsystems Inc.
    Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre
    Default locale: en_US, platform encoding: ANSI_X3.4-1968
    OS name: "linux", version: "4.4.0-97-generic", arch: "amd64", family: "unix"
    
  5. Oscar Scholten reporter

    Validated the build on my side using the 'with-coverage' profile. It all works fine here too. Thanks for looking into it!

  6. Log in to comment