Class java/util/UUID could not be instrumented

10,077 views
Skip to first unread message

katheri...@gmail.com

unread,
May 23, 2013, 11:57:58 PM5/23/13
to jac...@googlegroups.com
I am trying to run Jacoco for junit testing in Jenkins via ant task.

Referring to the online doc, I wrap my junit task in ant with jacoco.coverage.
When I run the junit task in linux command line, everything works fine. However, when I trigger the junit task from Jenkins, it throws the following exception:

[jacoco:coverage] Enhancing java with coverage
[java] Exception in thread "main" java.lang.reflect.InvocationTargetException [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native MFATAL ERROR in native method: processing of -javaagent failed [java] ethod) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [java] at java.lang.reflect.Method.invoke(Method.java:597) [java] at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323) [java] at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338) [java] Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented. [java] at org.jacoco.agent.rt.internal_5d10cad.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138) [java] at org.jacoco.agent.rt.internal_5d10cad.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:99) [java] at org.jacoco.agent.rt.internal_5d10cad.PreMain.createRuntime(PreMain.java:51) [java] at org.jacoco.agent.rt.internal_5d10cad.PreMain.premain(PreMain.java:43) [java] ... 6 more [java] Caused by: java.lang.NoSuchFieldException: $jacocoAccess [java] at java.lang.Class.getField(Class.java:1520) [java] at org.jacoco.agent.rt.internal_5d10cad.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:136) [java] ... 9 more [java] Java Result: 134

I also tried to run the example ant task shipped with the jacoco distribution and got the same result (works from command line, but exception from jenkins)

I suspect something in Jenkins or the tomcat server that hosts jenkins conflict with this java.util.UUID.

Has anyone encountered this before? Thank you so much for your help in advance :)

Marc R. Hoffmann

unread,
May 24, 2013, 12:17:39 AM5/24/13
to jac...@googlegroups.com
This happens with Java 8 (which not yet supported by JaCoCo).

What JRE version are you using?

katrin

unread,
May 24, 2013, 1:32:44 AM5/24/13
to jac...@googlegroups.com
Sorry I should have provided the versions:

JDK 1.6.0_17
Tomcat 6.0.35
Jacoco 0.6.2.2013020300002
Jenkins 1.513

Marc Hoffmann

unread,
May 24, 2013, 2:15:40 AM5/24/13
to jac...@googlegroups.com
This is strange. Are you sure this is the exact JVM which is also used
when running under Jenkins?

Can you configure your Jenkins Job to run the Ant script with the
"-debug" option. This should provide two infos in the log file:

1) The exact JDK Version
2) The command line used to execute your unit tests

Can you please doublecheck 1) and provide send 2)?

Thanks,
-marc

katheri...@gmail.com

unread,
May 24, 2013, 3:07:37 AM5/24/13
to jac...@googlegroups.com
This is SOOO strange - I can't understand at all:

First I tried to run the test task with -debug from Jenkins, and no errors anymore.
Then I tried to run the test task without -debug from Jenkins, still no error anymore.

FYR, below is some output from my ant task:
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Trying the default build file: build.xml
Buildfile: /xxx/jacoco/doc/examples/build/build.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.6 in: /xxx/jdk1.6.0_31/jre
Detected OS: Linux

Marc Hoffmann

unread,
May 24, 2013, 3:10:51 AM5/24/13
to jac...@googlegroups.com
Do you use multiple Slaves in Jenkins? Maybe there are different JREs
on different nodes...

katrin

unread,
May 24, 2013, 3:16:37 AM5/24/13
to jac...@googlegroups.com
No, I didn't setup any slave in Jenkins, and I think my servers don't even have jdk 1.8 installed......

Anyway I am trying a full build on Jenkins now, will update you of my result ;-)

katrin

unread,
May 24, 2013, 6:30:23 AM5/24/13
to jac...@googlegroups.com, katheri...@gmail.com
Unfortunately the issue persists again.....

Apache Ant(TM) version 1.8.2 compiled on December 20 2010

Adding reference: ant.PropertyHelper
Detected Java version: 1.6 in: /xxx/jdk1.6.0_31/jre
Detected OS: Linux

...
[antlib:org.jacoco.ant] Could not load definitions from resource org/jacoco/ant/antlib.xml. It could not be found.
Finding class org.jacoco.core.runtime.AgentOptions
Loaded from /xxx/jacoco/lib/jacocoant.jar org/jacoco/core/runtime/AgentOptions.class
Class org.jacoco.core.runtime.AgentOptions loaded from ant loader (parentFirst)...
...
Execute:Java13CommandLauncher: Executing '/usr/jdk1.6.0_31/jre/bin/java' with arguments:
'-javaagent:/tmp/jacocoagent7474638195405486305.jar=destfile=/xxx/jenkins/jobs/myapp/workspace/test_reports/jacoco.exec'
'-classpath'
'/xxx/jenkins/jobs/myapp/workspace/bin:/xxx/jenkins/jobs/myapp/workspace/lib/<all-the-jars>.jar:/xxx/jenkins/jobs/myapp/workspace/lib/test/junit-4.8.1.jar:/xxx/jenkins/jobs/myapp/workspace/lib/test/mockito-all-1.9.5-rc1.jar:/home/optimeqa/tomcat/apache-tomcat-6.0.35/bin/bootstrap.jar:/xxx/apache-ant-1.8.2/lib/ant-launcher.jar:/xxx/apache-ant-1.8.2/lib/ant.jar:/xxx/apache-ant-1.8.2/lib/ant-junit.jar:/xxx/apache-ant-1.8.2/lib/ant-junit4.jar'
'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
'testsfile=/xxx/jenkins/jobs/myapp/workspace/junittestcases4896000639805670110.properties'
'filtertrace=true'
'haltOnError=false'
'haltOnFailure=false'
'showoutput=false'
'outputtoformatters=true'
'logfailedtests=true'
'logtestlistenerevents=false'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,/xxx/jenkins/jobs/myapp/workspace/test_reports/IGNORETHIS.xml'
'crashfile=/xxx/jenkins/jobs/myapp/workspace/junitvmwatcher3328629704971248104.properties'
'propsfile=/xxx/jenkins/jobs/myapp/workspace/junit2716640935257940019.properties'

The ' characters around the executable and arguments are
not part of the command.
[junit] FATAL ERROR in native method: processing of -javaagent failed
[junit] Exception in thread "main" java.lang.reflect.InvocationTargetException
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at java.lang.reflect.Method.invoke(Method.java:597)
[junit] at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
[junit] at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
[junit] Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
[junit] at org.jacoco.agent.rt.internal_5d10cad.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138)
[junit] at org.jacoco.agent.rt.internal_5d10cad.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:99)
[junit] at org.jacoco.agent.rt.internal_5d10cad.PreMain.createRuntime(PreMain.java:51)
[junit] at org.jacoco.agent.rt.internal_5d10cad.PreMain.premain(PreMain.java:43)
[junit] ... 6 more
[junit] Caused by: java.lang.NoSuchFieldException: $jacocoAccess
[junit] at java.lang.Class.getField(Class.java:1520)
[junit] at org.jacoco.agent.rt.internal_5d10cad.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:136)
[junit] ... 9 more

Marc R. Hoffmann

unread,
May 25, 2013, 5:02:55 AM5/25/13
to jac...@googlegroups.com
What is the vendor of your JRE? Can you please execute

java -version

on your Jenkins node?

Thx,
-marc

katrin

unread,
May 26, 2013, 9:54:35 PM5/26/13
to jac...@googlegroups.com
[0]> java -version
java version "1.6.0_17"
OpenJDK Runtime Environment (IcedTea6 1.7.5) (rhel-1.16.b17.el5-i386)
OpenJDK Server VM (build 14.0-b16, mixed mode)

Marc R. Hoffmann

unread,
May 27, 2013, 1:52:19 AM5/27/13
to jac...@googlegroups.com
I've personally never tested OpenJDK 1.6, but so far no issue was
reported here. So I guess it is something specific to your setup. Maybe
you have a chance to figure out what the difference is between the
builds which work and the builds which fail?

-marc

katrin

unread,
Jun 5, 2013, 1:46:09 AM6/5/13
to jac...@googlegroups.com
I finally found out that the issue will happen whenever I run the build on Jenkins with coverity enabled. It doesn't matter if the junit test was run as a post-build task or even after coverity report generation.

yoges...@gmail.com

unread,
Jan 21, 2014, 9:13:25 PM1/21/14
to jac...@googlegroups.com
I am seeing same error and I am using Java8. On our new project, we are using Java 8 (and can not use Java 7).

Any ideal, when can we expect Java 8 supported??

Marc R. Hoffmann

unread,
Jan 22, 2014, 1:31:08 AM1/22/14
to jac...@googlegroups.com
Here you find a preview build which supports Java 8:
https://github.com/jacoco/jacoco/issues/74

A official release depends on the finalization of the Java 8 spec.

geert.ja...@gmail.com

unread,
Mar 10, 2014, 8:02:33 AM3/10/14
to jac...@googlegroups.com, katheri...@gmail.com
I also have this issue on a 64 bit IBM JRE7

==============

C:\IBM\WebSphere\AppServer\java_1.7_64\bin>java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build pwa6470sr4fp1ifix-20130423_02(SR4 FP1+IV3
8579+IV38399+IV40208))
IBM J9 VM (build 2.6, JRE 1.7.0 Windows 7 amd64-64 Compressed References 2013042
1_145945 (JIT enabled, AOT enabled)
J9VM - R26_Java726_SR4_FP1_2_20130421_2353_B145945
JIT - r11.b03_20130131_32403ifx4
GC - R26_Java726_SR4_FP1_2_20130421_2353_B145945_CMPRSS
J9CL - 20130422_145945)
JCL - 20130225_01 based on Oracle 7u13-b08

Marc Hoffmann

unread,
Mar 10, 2014, 8:19:28 AM3/10/14
to jac...@googlegroups.com
Hi,

we don't have any experience or tests with J9.

Best regards,
-marc

Diego Bosin

unread,
May 4, 2016, 10:58:00 AM5/4/16
to JaCoCo and EclEmma Users
Hi, 

I have this issue with jdk1.8.0_45 and jacoco 0.7.5 and 0.7.6. If I understood well, this was solved from jacoco 0.7.0 (https://github.com/jacoco/jacoco/issues/74). 

The stack is the following:

Exception in thread "main" java.lang.reflect.InvocationTargetException

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:497)

at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)

at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)

Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.

at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139)

at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:100)

at org.jacoco.agent.rt.internal_b0d6a23.PreMain.createRuntime(PreMain.java:55)

at org.jacoco.agent.rt.internal_b0d6a23.PreMain.premain(PreMain.java:47)

... 6 more

Caused by: java.lang.NoSuchFieldException: $jacocoAccess

at java.lang.Class.getField(Class.java:1703)

at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137)

... 9 more

FATAL ERROR in native method: processing of -javaagent failed


I'm configuring JAVA_OPTS in this way:

export JAVA_OPTS="-javaagent:/tmp/jacoco/lib/jacocoagent.jar=output=tcpserver,address=*,port=6300,includes=*"


Any idea to solve this?

Thanks!

Evgeny Mandrikov

unread,
May 4, 2016, 7:37:45 PM5/4/16
to JaCoCo and EclEmma Users
Hi,

Could you please post output of "java -version" ? And describe a bit more application under measurement ?

Luis Thur

unread,
May 5, 2016, 11:13:11 AM5/5/16
to JaCoCo and EclEmma Users
Hi Evgeny!
Yes, the output for java -version is:

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Thanks for your time.

Diego Bosin

unread,
May 5, 2016, 2:15:44 PM5/5/16
to JaCoCo and EclEmma Users, luis...@mercadolibre.com
Hi Evgeny,

In addition to what Luis said, the application is a rest API over grails 2.4.2, which use an oracle db. Do you need any other details?

Thanks!

Diego.

Evgeny Mandrikov

unread,
May 5, 2016, 2:25:48 PM5/5/16
to JaCoCo and EclEmma Users, luis...@mercadolibre.com
Ok, from here some thoughts: I've used for quite a while JaCoCo with JDK 8u45 on various projects without troubles. So don't think that problem relates to JDK and have feeling that it relates to application under test. According to your description won't be easy to quickly construct something similar as reproducer. Thus maybe you can provide such a reproducer? This will greatly speedup investigations. Also anyway I would suggest to try most recent JDK version just in case.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages