Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.HasBeenInstrumented
Asked Answered
B

2

6

We had installed version of our applications (without any instrumentation or cobertura jar included before generating application bundles).

After installation we instrumented all the jar with cobertura, and included cobertura jar file in java classpath. but while starting application it give below error.

any input will really help, thanks.

Java version "1.7.0_25"
cobertura ver 1.9.4.1

Exception in thread "main" java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/HasBeenInstrumented
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.HasBeenInstrumented
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 13 more
Brookweed answered 23/6, 2014 at 12:2 Comment(1)
How are you including Cobertura in the classpath? Does net/sourceforge/cobertura/coveragedata/HasBeenInstrumented.class exist in the JAR file that you're including in the classpath?Materiality
D
2

You should add cobetura.jar to Bootstrap Classes with -Xbootclasspath. More info: https://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html This needs to be done in order to load the cobetura classes, which are needed in order to load your app classes.

Daredeviltry answered 20/5, 2015 at 11:23 Comment(0)
B
-1

I have been able to get rid of this problem by running a late package goal, as it re-compiles and re-packages de code without Cobertura.

The goals I use are:

clean site package

Burd answered 1/3, 2018 at 21:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.