Can I get jacoco offline instrumentation for docker image i am running(spring boot webservice image)

263 views
Skip to first unread message

rahul.for...@gmail.com

unread,
Oct 1, 2018, 4:42:34 AM10/1/18
to JaCoCo and EclEmma Users
Hi All,

I am using docker to run my application which is spring boot restful webservice.

Can i use jacoco to fetch report after manual/automation test finish to check how much code we are hitting via QA team.

I started docker container via passing JAVA_OPTS=-javaagent:/opt/jacoco/lib/jacocoagent.jar=output=tcpserver,address=*,port=6300 .

and i can connect to via jacococli to get dump

java -jar /opt/jacoco/lib/jacococli.jar dump --address localhost --destfile /tmp/jacoco.exec

now geting report out of dump file i need to pass classfile also but hence i am running images how i can pass class files.

If my question is not clear let me know i will try to put it in other way i need to resolve same on high priority, Thanks.

Evgeny Mandrikov

unread,
Oct 1, 2018, 6:02:24 AM10/1/18
to JaCoCo and EclEmma Users
Hi,

You can either extract class files from your Docker image - please refer to Docker documentation about how to do this, or you can preserve them during construction of image for later use.

ravia...@gmail.com

unread,
Oct 12, 2018, 1:21:57 PM10/12/18
to JaCoCo and EclEmma Users

Hi, I am using the following command to start the service with offline instrumented code. Seeing error:
Caused by: java.lang.NoClassDefFoundError: org/jacoco/agent/rt/internal_773e439/Offline


Command am using is : java -cp org.jacoco.agent-0.8.2.jar -jar target/demo-0.0.1-SNAPSHOT.jar

Please help me what could be the issue here.

Thanks
Ravi

Marc Hoffmann

unread,
Oct 15, 2018, 1:35:03 AM10/15/18
to jac...@googlegroups.com
Hi Ravi,

this is not the agent you are using (org.jacoco.agent-0.8.2.jar is an API to provide the agent as a resource). In the manual download the agent is

lib/jacocoagent.jar

If you’re using Maven the agent’s coordinates are:

groupId: org.jacoco
artifactId: org.jacoco.agent
classifier: runtime

Regards,
-marc


-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/30ee9c75-a51c-48ac-a0bc-02c88091e2c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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