Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
I am facing some problem after instrumenting .class files.
Service bundles are coming up, throwing exception
SEVERE|null|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=12;_ThreadName=Thread-1;|org.osgi.framework.BundleException: Activator start error in bundle org.apache.felix.scr .
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.felix.scr.impl.Activator
at sun.reflect.GeneratedConstructorAccessor33.newInstance(Unknown Source)
… 8 more
Please guide if someone knows about this problem.
Marc R. Hoffmann
the reason for this problem can be probably found further down in your stacktrace: EMMA instrumented classes get an dependency on on emma.jar itself - which is not accessible within a OSGi container. Some years ago I analyzed this issue and described a solution for Equinox. The paper is available here:
Thanks for you reply.
I am using EMMA coverage tool on Linux platform. So as per your comment what I am getting is that in Manifest file of Emma.jar i need to export the path "Export-Package: com.vladium.emma.rt " and the instrumented jars will import the same package "Export-Package: com.vladium.emma.rt " in their respective manifest files.
Let me know if I am wrong in this.
Marc R. Hoffmann
Correct! If it is possible for you to modify your manifests in this way this should work.
Note that EMMA isn't a OSGi bundle. So you need to specify a proper manifest first an make sure to install it in your felix instance.
I have modified the manifest files for emma.jar and service bundles.
Install it in your felix instance?? I didn't get this. What exactly did u mean by this?
I have put my emma.jar in the jre extensions.
Sorry for this confusion, I don't know felix. Let's phrase it this way: The bundled version of emma.jar needs to be made available to felix as a regular bundle, like the instrumented bundles.
The JRE extensions trick won't work as per default a OSGi container only allows to load java.* from the JRE.
BTW, due to all these hassles with containers I created an alternative code coverage library JaCoCo which does not have these issues by design.