Hi Greg/Marc,

I'm hitting the same exception even after adding "jacocoagent.jar" to 
classpath in surefire plugin.

*pom.xml (surefire - plugin configuration):*
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                
<artifactId>maven-surefire-plugin</artifactId>
                                <configuration>
                                        <forkmode>once</forkmode>
                                        <additionalClasspathElements>
                                            
 <additionalClasspathElement>jacocoagent.jar</additionalClasspathElement>
                                        </additionalClasspathElements>
                                </configuration>
                        </plugin>

Renamed the "org.jacoco.agent-0.7.7.201606060606-runtime.jar" (from local 
maven repository) to "jacocoagent.jar" and kept that in the same folder 
where this pom.xml is residing.

*Exception seen on console:*

*#############*
Number of foreign imports: 1

import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------

        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:166)
        ... 21 more
Caused by: java.lang.NoClassDefFoundError: 
org/jacoco/agent/rt/internal_6da5971/Offline
        at 
com.cisco.ise.ups.modelframework.hibernate.OracleNamingStrategy.$jacocoInit(OracleNamingStrategy.java)
        at 
com.cisco.ise.ups.modelframework.hibernate.OracleNamingStrategy.<clinit>(OracleNamingStrategy.java)
        at sun.misc.Unsafe.ensureClassInitialized(Native Method)
        at 
sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
        at 
sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:142)
        at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1082)
        at java.lang.reflect.Field.getFieldAccessor(Field.java:1063)
        at java.lang.reflect.Field.get(Field.java:387)
        at 
com.cisco.ise.ups.build.WorkflowRunnerMojo.namingStrategyInstance(WorkflowRunnerMojo.java:335)
        at 
com.cisco.ise.ups.build.WorkflowRunnerMojo.setupWorkflowEnvironment(WorkflowRunnerMojo.java:514)
        at 
com.cisco.ise.ups.build.WorkflowRunnerMojo.execute(WorkflowRunnerMojo.java:816)
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        ... 21 more
Caused by: java.lang.ClassNotFoundException: 
org.jacoco.agent.rt.internal_6da5971.Offline
        at 
org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
        at 
org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
        at 
org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
        at 
org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
        ... 33 more
[ERROR]
*###############*

Can you please let me know how to resolve this ? Please let me know if I 
should be sending complete pom !!!

-Regards,
Kesav.


On Tuesday, August 23, 2016 at 2:08:21 AM UTC+5:30, Marc R. Hoffmann wrote:
>
> No idea about Gradle and Android. First thing I would check is whether 
> jacocoagent.jar is contained in the path given by the error message:
>
> Didn't find class "org.jacoco.agent.rt.internal_14f7ee5.Offline" on path: 
> DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file 
> "/data/app/com.ourapp.next.debug.test-1/base.apk", zip file 
> "/data/app/com.ourapp.next.debug-2/base.apk"],nativeLibraryDirectories=[/vendor/lib,
>  
> /system/lib]]
>
> Regards,
> -marc
>
> On 22.08.16 22:28, Greg Loesch wrote:
>
> Hm... do you have any tips to help troubleshoot this?
>
> On Mon, Aug 22, 2016 at 12:21 PM Marc R. Hoffmann <
> hoff...@mountainminds.com <javascript:>> wrote:
>
>> Looks like you use offline instrumentation (which is actually required
>> if you want to run your tests on Android) but jacocoagent.jar is missing
>> on your classpath. Or jacocoagent.jar is a different version then the
>> JaCoCo version to instrument your classes.
>>
>> Regard,
>> -marc
>>
>> On 22.08.16 18:53, loesc...@gmail.com <javascript:> wrote:
>> > I'm currently using Jacoco in Android with Gradle Build Tools 2.1.3 and 
>> Gradle(wrapper) 2.14.1. I get the following when running my instrumentation 
>> tests:
>> >
>> > java.lang.NoClassDefFoundError: Failed resolution of: 
>> Lorg/jacoco/agent/rt/internal_14f7ee5/Offline;
>> > at 
>> com.ourapp.next.conversation.SomeList.SomeListViewModel.$jacocoInit(SomeListViewModel.java)
>> > at 
>> com.ourapp.next.conversation.SomeList.SomeListViewModel.<init>(SomeListViewModel.java)
>> > at 
>> com.ourapp.next.conversation.SomeList.SomeListAdapterTest.<clinit>(SomeListAdapterTest.java:26)
>> > at java.lang.reflect.Constructor.newInstance(Native Method)
>> > at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
>> > at 
>> org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
>> > at 
>> org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
>> > at 
>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>> > at 
>> org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
>> > 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.runners.Suite.runChild(Suite.java:128)
>> > at org.junit.runners.Suite.runChild(Suite.java:27)
>> > 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 org.junit.runner.JUnitCore.run(JUnitCore.java:115)
>> > at 
>> android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
>> > at 
>> android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262)
>> > at 
>> android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1853)
>> > Caused by: java.lang.ClassNotFoundException: Didn't find class 
>> "org.jacoco.agent.rt.internal_14f7ee5.Offline" on path: DexPathList[[zip 
>> file "/system/framework/android.test.runner.jar", zip file 
>> "/data/app/com.ourapp.next.debug.test-1/base.apk", zip file 
>> "/data/app/com.ourapp.next.debug-2/base.apk"],nativeLibraryDirectories=[/vendor/lib,
>>  
>> /system/lib]]
>> > at 
>> dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
>> > at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
>> > at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
>> > ... 30 more
>> > Suppressed: java.lang.ClassNotFoundException: 
>> org.jacoco.agent.rt.internal_14f7ee5.Offline
>> > at java.lang.Class.classForName(Native Method)
>> > at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
>> > at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
>> > at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
>> > ... 31 more
>> > Caused by: java.lang.NoClassDefFoundError: Class not found using the 
>> boot class loader; no stack available
>> >
>> > Any suggestions?
>> >
>>
>>
>> --
>> Marc Hoffmann
>> hoff...@mountainminds.com <javascript:>
>> _______________________________________________
>> Mountainminds GmbH & Co. KG
>>
>> Nussbaumstr. 4 * 80336 Muenchen * Germany
>> Phone/Fax +49-700-68664637 * 0700-MTNMINDS
>>
>> Registergericht Muenchen * HRA 80201
>> Mountainminds Verwaltungs GmbH
>> Registergericht Muenchen * HRB 143183
>> Geschaeftsfuehrer Marc Hoffmann
>>
>> --
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "JaCoCo and EclEmma Users" group.
>> To unsubscribe from this topic, visit 
>> <https://groups.google.com/d/topic/jacoco/K0DYIo0ekHk/unsubscribe>
>> https://groups.google.com/d/topic/jacoco/K0DYIo0ekHk/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> jacoco+un...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> <https://groups.google.com/d/msgid/jacoco/79a1c9d6-e94d-e6b3-02b3-f85e9c205d43%40mountainminds.com>
>> https://groups.google.com/d/msgid/jacoco/79a1c9d6-e94d-e6b3-02b3-f85e9c205d43%40mountainminds.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jacoco+un...@googlegroups.com <javascript:>.
> To view this discussion on the web visit 
> <https://groups.google.com/d/msgid/jacoco/CAG0Kj9eqt4bGipDxfojQCHdmYP7HFPC1p3_kkcc%3DYoQVcOJASw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> https://groups.google.com/d/msgid/jacoco/CAG0Kj9eqt4bGipDxfojQCHdmYP7HFPC1p3_kkcc%3DYoQVcOJASw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/cf1bd89c-374e-4231-803a-e65b97bca7b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to