jacoco-0.7.1:Jacoco does not support IBM JDK 1.7

388 views
Skip to first unread message

ign...@gmail.com

unread,
Jul 1, 2014, 7:47:41 AM7/1/14
to jac...@googlegroups.com
Environment:
OS: CentOS 6.5 64-bit
WebSphere: 8.5.5.2 with JDK 1.7.0.4 32 bit
add parameter "-javaagent:/opt/jcc/jacocoagent.jar=includes=com.yyy.*,output=tcpserver,address=xxx.xxx.xxx.xx,port=16666" in JVM.
I tried to start application server, but threw below exception. I tested with IBM JDK 1.6, everything is fine.
----------------------------------------------------------------------
Fatal error: processing of -javaagent failed
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:404)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:419)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
at org.jacoco.agent.rt.internal_932a715.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139)
at org.jacoco.agent.rt.internal_932a715.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:100)
at org.jacoco.agent.rt.internal_932a715.PreMain.createRuntime(PreMain.java:55)
at org.jacoco.agent.rt.internal_932a715.PreMain.premain(PreMain.java:47)
... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
at java.lang.Class.getFieldImpl(Native Method)
at java.lang.Class.getField(Class.java:854)
at org.jacoco.agent.rt.internal_932a715.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137)
... 9 more
----------------------------------------------------------------------

Marc Hoffmann

unread,
Jul 1, 2014, 11:14:34 AM7/1/14
to jac...@googlegroups.com
Hi,

we only test against Sun/OpenJDK 1.5, 1.6, 1.7 and 1.8. Currently we
cannot consider other JREs vendors.

The problem is with the "runtime access", the strategy to connect
instrumented classes with the JaCoCo runtime. We have several
implementations, all with different pros and cons. Unfortunatelly one of
them (which works best with the JRE above) is hardcoded on the JaCoCo
agent. Future versions of JaCoCo might have a option to switch between
different runtimes.

Alternatively you can use "offline instrumentation" which dies not need
"runtime access" as the instrumented classes get a direct dependency on
JaCoCo: http://www.eclemma.org/jacoco/trunk/doc/offline.html

Best regards,
-marc

ign...@gmail.com

unread,
Jul 1, 2014, 11:48:09 AM7/1/14
to jac...@googlegroups.com

Hi Marc,

Thanks for your reply.
I have read the offline instrumentation carefully . As you said, i must find the right way to use offline mode, but i have below limits when i am using JaCoCo:
1. I could not intervene in development because i am a QA. The devlopment team will deliver the application EAR package to me, then i only need deploy it on WebSphere for testing.
2. the testing is a black-box test.

I think i only need copy jacoco-agent.properties and jacocoagent.jar into WebSphere library (the websphere will load the jar and the properties file), then stop application server after running test cases. Can I get the test coverage?
If my way is wrong, what can i do?

Best regards
Matthew


Marc Hoffmann

unread,
Jul 1, 2014, 11:56:07 AM7/1/14
to jac...@googlegroups.com
Hi,

unfortunatelly offline mode also needs the class files within your
webapp to be physically instrumented. This is the main drawback of
offline instrumentation.

Best regards,
-marc
Message has been deleted

ign...@gmail.com

unread,
Jul 1, 2014, 12:14:24 PM7/1/14
to jac...@googlegroups.com
Hi,

You means that the physically instrumented must be done in developing, is it?
Can i execute the task "instrument" on ear package to do instrument before deployment?

Best regards
Matthew




在 2014年7月1日星期二UTC+8下午11时56分07秒,Marc R. Hoffmann写道:

Marc Hoffmann

unread,
Jul 1, 2014, 12:19:34 PM7/1/14
to jac...@googlegroups.com
> Can i execute the task "instrument" on ear package to do instrument
> before deployment?

That should work.

ddr...@gmail.com

unread,
Dec 3, 2014, 4:14:32 AM12/3/14
to jac...@googlegroups.com
I have the same problem, then open the WebSphere debug mode, everything is okay!

anupku...@gmail.com

unread,
Mar 21, 2016, 1:03:24 PM3/21/16
to JaCoCo and EclEmma Users

Hi,

I am using Jacoco 2.0.1 version but still i am getting the same exception.
Jacoco is not able to run any of the Junit test suit as well as it is not able to create report, It is throwing exception.

Could you please help me as soon as possible so that i can proceed further.

Thanks in Advance.

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages