JACOCO TCP METHOD(RUN TIME)

84 views
Skip to first unread message

Vansh Kumar Madan

unread,
Sep 25, 2020, 8:57:28 PM9/25/20
to JaCoCo and EclEmma Users

Hi ,

I am trying to run integration tests on my java code from remote server, so whenver my tests hit my code server, jacoco records it.

I am new to jacoco, till now i have gather that there is tcp server method which doesnot require any restart.
1) I have added below line in my /etc/profile.

export JAVA_OPTS="-javaagent:/home/vansh/jacoco/lib/jacocoagent.jar=address=*,port=57026,destfile=/home/vansh/jacoco/jacoco.exec,output=tcpserver"

2)but when i am trying to take dump using below command -

java -jar jacococli.jar dump --address * --port  57026 --destfile /home/vansh/jacoco/jacoco.exec

ERROR :: Exception in thread "main" java.net.UnknownHostException: jacococli.jar: Name or service not known
    at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929)
    

I checked that there is nothing running on port 57026, after i reload /etc/profile , could anyone confirm where i am going wrong?
Thanks in advance

Marc Hoffmann

unread,
Sep 26, 2020, 2:36:33 AM9/26/20
to jac...@googlegroups.com
Hi,

the dump command requires a specific IP address or host name to connect to:

java -jar jacococli.jar dump --address YourServer --port  57026 --destfile /home/vansh/jacoco/jacoco.exec

If you run the command on the same machine “localhost” also works.

Regards,
-marc



This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the "From:" field.

--
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/084e0f3d-dd52-4101-bdf1-805ca8d1e800n%40googlegroups.com.

Vansh Kumar Madan

unread,
Sep 26, 2020, 5:11:47 AM9/26/20
to JaCoCo and EclEmma Users

Hi Mark,

After executing command with localhost:

java -jar jacococli.jar dump --address localhost --port  57026 --destfile /home/vansh/jacoco/jacoco-it.exec

Getting ERROR:

[INFO] Connecting to localhost/127.0.0.1:57026.
[WARN] Connection refused (Connection refused).
[INFO] Connecting to localhost/127.0.0.1:57026.
Exception in thread "main" java.net.ConnectException: Connection refused (Connection refused)
    at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
    at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
    at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)

Marc Hoffmann

unread,
Sep 28, 2020, 3:45:37 AM9/28/20
to jac...@googlegroups.com
This means there is no JaCoCo agent running on localhost

You probably need to specify the IP address of your “remote server”.


Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages