Cannot generate exec file with Jacoco agent

2,312 views
Skip to first unread message

Immonnan

unread,
Aug 9, 2018, 2:57:59 PM8/9/18
to JaCoCo and EclEmma Users
Hi there,

I am using Jacoco agent to generate code coverage report on my Websphere server following this blog (https://dzone.com/articles/verifying-end-to-end-test-code-coverage-using-jaco). To start the jacoco agent, I added the scripts to my jvm.options and the server started successfully:

-Djavaagent=<path to jaccoc>/jacocoagent.jar=port=6300,destfile=jacoco-remote.exec,output=tcpserver,address=*
-DXshareclasses=none

After that, I tried to do automation RestAPI tests and the tests have passed. The tests are built with maven and successfully configured for Jacoco. But there are no exec files generated on the server. I cannot pull jacoco data from my server neither.

And here is the error:
[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.1:dump (pull-test-data) on project auto.root: Unable to dump coverage data: Connection refused (Connection refused) -> [Help 1]

I doubt that the jacoco agent is not running on my server. But I do not find more solutions to this problem.

Thanks for the help in advance.

Marc Hoffmann

unread,
Aug 9, 2018, 3:00:18 PM8/9/18
to jac...@googlegroups.com
Hi,

-Dkey=value is how you add system properties. Take a look at our documentation how to specify a JVM agent:


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/9aac6d39-afc6-44c0-930c-226697bdf0e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Xiaohan Gao

unread,
Aug 9, 2018, 4:16:34 PM8/9/18
to jac...@googlegroups.com
Hi Marc,

I found everything is legal after double check the documentation you mentioned. Still not sure about where the problem is.

On Thu, Aug 9, 2018 at 12:00 PM, Marc Hoffmann <hoff...@mountainminds.com> wrote:
Hi,

-Dkey=value is how you add system properties. Take a look at our documentation how to specify a JVM agent:


Regards,
-marc

On 9. Aug 2018, at 20:57, Immonnan <xiaohangao2017@u.northwestern.edu> wrote:

Hi there,

I am using Jacoco agent to generate code coverage report on my Websphere server following this blog (https://dzone.com/articles/verifying-end-to-end-test-code-coverage-using-jaco). To start the jacoco agent, I added the scripts to my jvm.options and the server started successfully:

-Djavaagent=<path to jaccoc>/jacocoagent.jar=port=6300,destfile=jacoco-remote.exec,output=tcpserver,address=*
-DXshareclasses=none

After that, I tried to do automation RestAPI tests and the tests have passed. The tests are built with maven and successfully configured for Jacoco. But there are no exec files generated on the server. I cannot pull jacoco data from my server neither.

And here is the error:
[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.1:dump (pull-test-data) on project auto.root: Unable to dump coverage data: Connection refused (Connection refused) -> [Help 1]

I doubt that the jacoco agent is not running on my server. But I do not find more solutions to this problem.

Thanks for the help in advance.

--
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+unsubscribe@googlegroups.com.

--
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/_n7hMYaRasE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/B864DF0A-5F7D-4B00-806F-BF18A4899FEA%40mountainminds.com.

Marc Hoffmann

unread,
Aug 9, 2018, 4:30:10 PM8/9/18
to jac...@googlegroups.com
I’s just one character:

WRONG: -Djavagent
CORRECT: -javaagent


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/CADhY4RedAqc9%3DamtAW8dtnd0umKfWZ9jnyAdMN--85DYGc8rgA%40mail.gmail.com.

Xiaohan Gao

unread,
Aug 9, 2018, 4:34:37 PM8/9/18
to jac...@googlegroups.com
But if I modify it as you mentioned, the server will not be able to start with the following error message:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

Unrecognized option: -javaagent=<path to jacoco>/jacocoagent.jar=port=6300,destfile=jacoco-remote.exec,output=tcpserver,address=*

Error: Could not create the Java Virtual Machine.

Error: A fatal exception has occurred. Program will exit.



On Thu, Aug 9, 2018 at 1:30 PM, Marc Hoffmann <hoff...@mountainminds.com> wrote:
I’s just one character:

WRONG: -Djavagent
CORRECT: -javaagent


--
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/_n7hMYaRasE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.

Marc Hoffmann

unread,
Aug 9, 2018, 4:36:33 PM8/9/18
to jac...@googlegroups.com
Did you replace "<path to jacoco>” with the actual location on your system???


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/CADhY4RcHOU%2BGdFcuuv1uDnN7ujLf3zTfQ9j9uwOQL%3DbKMOWzmQ%40mail.gmail.com.

Xiaohan Gao

unread,
Aug 9, 2018, 4:37:57 PM8/9/18
to jac...@googlegroups.com
Yes I did. 

On Thu, Aug 9, 2018 at 1:36 PM, Marc Hoffmann <hoff...@mountainminds.com> wrote:
Did you replace "<path to jacoco>” with the actual location on your system???


--
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/_n7hMYaRasE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.

Xiaohan Gao

unread,
Aug 9, 2018, 4:38:42 PM8/9/18
to jac...@googlegroups.com
The problem is that only after I adding 'D' before 'javaagent', there will be no more error message

Marc Hoffmann

unread,
Aug 9, 2018, 4:40:20 PM8/9/18
to jac...@googlegroups.com
Because then it is plain system property definition which will not have any effect at all.

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/CADhY4RcNTx0YXksJ3%3Dwn9gBSZvj9udSYQmGhngBRNTx2%3DK%2Bgsw%40mail.gmail.com.

Xiaohan Gao

unread,
Aug 9, 2018, 4:48:26 PM8/9/18
to jac...@googlegroups.com
But I removed 'D' and the server cannot be started anymore.... Is there any other thing I can do?

On Thu, Aug 9, 2018 at 1:40 PM, Marc Hoffmann <hoff...@mountainminds.com> wrote:
Because then it is plain system property definition which will not have any effect at all.

On 9. Aug 2018, at 22:38, Xiaohan Gao <xiaohangao2017@u.northwestern.edu> wrote:

The problem is that only after I adding 'D' before 'javaagent', there will be no more error message

--
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/_n7hMYaRasE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.

Marc Hoffmann

unread,
Aug 9, 2018, 4:52:22 PM8/9/18
to jac...@googlegroups.com
Because you still have an syntax error:

WRONG: -javaagent=…
CORRECT: -javaagent:…

It is colon not equals.

Please, please, try to read the documentation!


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/CADhY4RcA%2BC7NPm-Ki4WyvzKT0GHex96ceOTQm%3DVG9jXxknkjDg%40mail.gmail.com.

Evgeny Mandrikov

unread,
Aug 9, 2018, 4:53:53 PM8/9/18
to JaCoCo and EclEmma Users
Hi,

On Thursday, August 9, 2018 at 10:48:26 PM UTC+2, Xiaohan Gao wrote:
Is there any other thing I can do?

You can study a bit more carefully documentation and mentioned by you blog.


Execution of

java -help

shows

    -D<name>=<value>
                  set a system property

    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument

Thus

java -Djavaagent:jacoco-0.8.1/lib/jacocoagent.jar=port=6300

is wrong.

java -javaagent=jacoco-0.8.1/lib/jacocoagent.jar=port=6300

is also wrong because after "-javaagent" should be colon! and equal sign is only after path.

Correct is:

java -javaagent:jacoco-0.8.1/lib/jacocoagent.jar=port=6300


Exactly as written in https://www.jacoco.org/jacoco/trunk/doc/agent.html and in mentioned by you blog.


Regards,
Evgeny

Xiaohan Gao

unread,
Aug 9, 2018, 4:56:28 PM8/9/18
to jac...@googlegroups.com
The problem is that if I use 
java -Djavaagent:jacoco-0.8.1/lib/jacocoagent.jar=port=6300

Then the server will not be able to start with 

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

Unrecognized option: -javaagent=jacoco-0.8.1/jacocoagent.jar=port=6300,destfile=jacoco-remote.exec,output=tcpserver,address=*

Error: Could not create the Java Virtual Machine.

Error: A fatal exception has occurred. Program will exit.

Marc Hoffmann

unread,
Aug 9, 2018, 5:00:19 PM8/9/18
to jac...@googlegroups.com
The error message clearly says that you still using using equals (=) not colon (:)

Yep, computer, are very picky about syntax. Every character counts ;)


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/CADhY4RcBggGpf4-GJbgQVrkh0_5%2BgTEf%3D_xvNy%2B4nC6590g8bA%40mail.gmail.com.

Evgeny Mandrikov

unread,
Aug 9, 2018, 5:00:26 PM8/9/18
to JaCoCo and EclEmma Users
Let me repeat again: after "-javaagent" should be colon!

msg.png

Xiaohan Gao

unread,
Aug 9, 2018, 5:03:49 PM8/9/18
to jac...@googlegroups.com
Oh gosh, I finally see it.

Sorry about that stupid mistake and many thanks for your help.

Marc Hoffmann

unread,
Aug 9, 2018, 5:04:46 PM8/9/18
to jac...@googlegroups.com
You’re welcome! Good luck with your project!

-marc
 
On 9. Aug 2018, at 23:03, Xiaohan Gao <xiaohan...@u.northwestern.edu> wrote:

Oh gosh, I finally see it.

Sorry about that stupid mistake and many thanks for your help.
On Thu, Aug 9, 2018 at 2:00 PM, Evgeny Mandrikov <mand...@gmail.com> wrote:
Let me repeat again: after "-javaagent" should be colon!

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/CADhY4Re5EtVyAZ5g%2BXUP5xxvsLdSNLAwzyb1a_%3D8OFWbRODuJA%40mail.gmail.com.
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Marc Hoffmann

unread,
Aug 16, 2018, 6:54:10 AM8/16/18
to jac...@googlegroups.com

Hi,

glad to hear and thanks for the update! Maybe you can share your findings here so others can learn from it?

Cheers,
-marc

On 2018-08-16 00:04, Xiaohan Gao wrote:

Hi,
 
I have solved all these stupid problems. Thanks to all of your help. Jacoco is great

On Tue, Aug 14, 2018 at 3:41 PM, Xiaohan Gao <xiaohan...@u.northwestern.edu> wrote:
Hi there, 
 

I found that my jacoco agent on the server side is now working correctly and produced a jacoco.exec file. No need to worry about my previous two mails. This file seems to have correct coverage rate as I have opened it in eclipse - coverage view. 
 
 
The only problem is that I am not sure how to pull down the class files from my remote server, to make the classes in "report" phase match the classes used when generating the exec file.


--
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.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages