Re: [java code coverage] [jacoco:dump] connecting to /xxx.xx.xx.xxx:6300 [jacoco:dump]Connection refused :connect

1,196 views
Skip to first unread message

Marc R. Hoffmann

unread,
Mar 30, 2017, 2:19:36 AM3/30/17
to jac...@googlegroups.com
Hi,

how did you configure the JaCoCo agent on the server? By default it only binds to the loopback interface only and is therefore not accessible from remote hosts. To bind to all hosts you need to configure address=* for the agent. See documentation:

address IP address or hostname to bind to when the output method is tcpserver or connect to when the output method is tcpclient. In tcpserver mode the value "*" causes the agent to accept connections on any local address. loopback interface

http://www.jacoco.org/jacoco/trunk/doc/agent.html

With netstat -a you can verify to which interface the agent actually binds (look for lines with "LISTEN").

Regards,
-marc


On 30.03.17 04:56, beingji...@gmail.com wrote:
Hi,
  I need a urgent to generate jacoco remote by accessing a server running remotely. Somehow, I can access that server without authentication. I am trying jacoco on the fly instrumentation (output=tcpserver) and trying to dump instrumented  data by running a ant task from local machine. Please see be build.xml. Somehow I am not able to connect remote server.

I would highly appreciate any help regarding that.

<project name="JaCoCo" xmlns:jacoco="antlib:org.jacoco.ant">

<property name="result.exec.file" value="jacoco.exec"/>
    <property name="server" value="remote server if" />
    <property name="port" value ="6300" />

    <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
      <classpath path="jacocoant.jar"/>
    </taskdef>   


    <target name="get_data">
      <jacoco:dump address="${server}" port="${port}" reset="true" append="false" destfile="${result.exec.file}"/>
    </target>


</project>



beingji...@gmail.com

unread,
Mar 31, 2017, 12:36:38 PM3/31/17
to JaCoCo and EclEmma Users

Thanks Marc,

Please see below jacoco agent configuration:

-javaagent:/test/jacoco/jacocoagent.jar=output=tcpserver,address="remoteAddress"

Ant task:

<target name="getdata">
<jacoco:dump address="remoteAddress" port="6300" append="false" destfile="${result.exec.file}"/>
</target>

My remote server require authentication and so I can not use ant task. As per documentation jacoco does not provide any authentication mechanisms. So I tried with jacoco java API ExecutionDataClient, I am able to run and dump instrumented data for local server. Now I am trying the same for remote sever. Can you please suggest about that.

Thanks.
Jitendra Tiwari

Marc R. Hoffmann

unread,
Apr 1, 2017, 2:26:12 AM4/1/17
to jac...@googlegroups.com
Hi,

> -javaagent:/test/jacoco/jacocoagent.jar=output=tcpserver,address="remoteAddress"

this will not work. For address you need to specify a local interface of
the server, or * to bind to all interfaces.

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