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

On 2014-07-01 17:48, [email protected] wrote:
On Tuesday, July 1, 2014 11:14:34 PM UTC+8, Marc R. Hoffmann wrote:
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









On 2014-07-01 13:47, [email protected] wrote:

> 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

> ----------------------------------------------------------------------

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

--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to