Discussion:
[java code coverage] JACOCO-0.7.6+Tomcat-8.0.2.3+Jenkins, Connection refused to TCP server, Unable to dump.
Anil Satya
2016-08-16 13:59:20 UTC
Permalink
I have done the required research before adding this topic. Could not find
a proper match, so created new thread.

*This is my Ant Dump task*:

<target name="dump-now" depends="init">
<echo message="entering dump part" />
<jacoco:dump address="MyServer" port="6090" dump="true"
destfile="${coverage.dir}/lmjacoco.exec" retryCount="10" />
</target>


This is my jenkins JAVA_ARG setup:


JAVA_OPTS=-javaagent:/tools/jacoco-0.7.6/lib/jacocoagent.
jar=includes=com.manh.*:com.logistics.*,destfile=/builds/
v2017/lm/deployments/lm/tomcat-ora/distribution/
coverage/lmjacoco.exec,output=tcpserver


My tomcat application is started on port: 26000.


The TCP port mentioned in the ant task isn't being used by any other
process. The below is the error available in the jenkins console (Edited to
remove actual server name and IP address):



*generate-report: [echo] Generating xml report....*

*init:*





*dump-now: [echo] entering dump part[jacoco:dump] Connecting to
MyServer:6090[jacoco:dump] Connection refused*


Is there a problem with this setup. I've also tried the alternative where I
give the address and TCP port in the Jenkins JAVA_OPTS itself. Please help.
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/f2890b53-58fc-456b-a10d-5e71c66cabfe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Anil Satya
2016-08-16 14:02:22 UTC
Permalink
OS is RHEL 7 with OpenJDK - 8_52
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/0767c9e5-6c30-4654-a3da-d689b692be3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Evgeny Mandrikov
2016-08-17 07:48:20 UTC
Permalink
Hi,

You run agent without explicit specification of port, so that it uses
default "6300" ( see http://www.eclemma.org/jacoco/trunk/doc/agent.html and
http://www.eclemma.org/jacoco/trunk/doc/ant.html#coverage ), while you
request dump from port "6090".

Hope this helps.
Post by Anil Satya
I have done the required research before adding this topic. Could not find
a proper match, so created new thread.
<target name="dump-now" depends="init">
<echo message="entering dump part" />
<jacoco:dump address="MyServer" port="6090" dump="true"
destfile="${coverage.dir}/lmjacoco.exec" retryCount="10" />
</target>
JAVA_OPTS=-javaagent:/tools/jacoco-0.7.6/lib/jacocoagent.
jar=includes=com.manh.*:com.logistics.*,destfile=/builds/
v2017/lm/deployments/lm/tomcat-ora/distribution/
coverage/lmjacoco.exec,output=tcpserver
My tomcat application is started on port: 26000.
The TCP port mentioned in the ant task isn't being used by any other
process. The below is the error available in the jenkins console (Edited to
*generate-report: [echo] Generating xml report....*
*init:*
*dump-now: [echo] entering dump part[jacoco:dump] Connecting to
MyServer:6090[jacoco:dump] Connection refused*
Is there a problem with this setup. I've also tried the alternative where
I give the address and TCP port in the Jenkins JAVA_OPTS itself. Please
help.
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/d2eef333-14df-418d-958c-3b44815d5766%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Anil Satya
2016-08-18 14:48:24 UTC
Permalink
Hello Evgeny,

Thanks a lot for the timely reply. As per your suggestion, these are
now my JAVA_OPTS:

JAVA_OPTS=-javaagent:/tools/jacoco-0.7.6/lib/jacocoagent.jar=includes=com.manh.*:com.logistics.*,destfile=/builds/v2017/lm/deployments/lm/tomcat-ora/distribution/coverage/lmjacoco.exec,output=tcpserver,port=65000


*The connection refused exception is now gone, but the .exec file recieved
only 5 Bytes of data and the sessions tab shows this message:*
Sessions

No session information available.

No execution data available.


Also, the jenkins console had this:


dump-now:
[echo] entering dump part
[jacoco:dump] Connecting to MyTCPServer:65000
[jacoco:dump] Dumping execution data to
/builds/v2017/lm/deployments/lm/tomcat-ora/distribution/coverage/lmjacoco.exec
[jacoco:report] Loading execution data file
/builds/v2017/lm/deployments/lm/tomcat-ora/distribution/coverage/lmjacoco.exec
[jacoco:report] Writing bundle 'Code Coverage Report from JaCoCo for LM'
with 3523 classes
[echo]
/staging/2017/jenkin-slave/vci-wmlm-17/workspace/LM_2017_CI_LJO_DAILY_DEPLOYMENT
[copy] Copying 1 file to
/staging/2017/jenkin-slave/vci-wmlm-17/workspace/LM_2017_CI_LJO_DAILY_DEPLOYMENT
[copy] Copying 7307 files to
/staging/2017/jenkin-slave/vci-wmlm-17/workspace/LM_2017_CI_LJO_DAILY_DEPLOYMENT


Looks like I've come very close and I'm doing some small mistake. Can you
please help me out?
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/1271dc01-387e-4f95-9e8f-0832bdfd83b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Anil Satya
2016-08-18 14:49:52 UTC
Permalink
Hello Evgeny,

Thanks a lot for the timely reply. As per your suggestion, these are
now my JAVA_OPTS:

JAVA_OPTS=-javaagent:/tools/
jacoco-0.7.6/lib/jacocoagent.jar=includes=com.manh.*:com.logistics.*,destfile=/builds/v2017/lm/deployments/lm/tomcat-ora/distribution/coverage/lmjacoco.exec,output=tcpserver,port=65000


*The connection refused exception is now gone, but the .exec file recieved
only 5 Bytes of data and the sessions tab shows this message:*
Sessions

No session information available.

No execution data available.


Also, the jenkins console had this:


dump-now:
[echo] entering dump part
[jacoco:dump] Connecting to MyTCPServer:65000
[jacoco:dump] Dumping execution data to /builds/v2017/lm/deployments/
lm/tomcat-ora/distribution/coverage/lmjacoco.exec
[jacoco:report] Loading execution data file /builds/v2017/lm/deployments/
lm/tomcat-ora/distribution/coverage/lmjacoco.exec
[jacoco:report] Writing bundle 'Code Coverage Report from JaCoCo for LM'
with 3523 classes
[echo] /staging/2017/jenkin-slave/vci-wmlm-17/workspace/LM_2017_
CI_LJO_DAILY_DEPLOYMENT
[copy] Copying 1 file to /staging/2017/jenkin-slave/
vci-wmlm-17/workspace/LM_2017_CI_LJO_DAILY_DEPLOYMENT
[copy] Copying 7307 files to /staging/2017/jenkin-slave/
vci-wmlm-17/workspace/LM_2017_CI_LJO_DAILY_DEPLOYMENT


Looks like I've come very close and I'm doing some small mistake. Can you
please help me out?
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/a7eabc10-6063-4cf3-9f06-32cdcfb739d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Evgeny Mandrikov
2016-08-18 17:40:49 UTC
Permalink
Possible checklist:

-
- check that server is up while dump is performed, i.e. that you don't
face issue similar to
https://groups.google.com/d/msg/jacoco/9UUoA28GvB8/vCPAz0E_CAAJ , JaCoCo
0.7.7 contains improvement which helps to detect such situation -
https://github.com/jacoco/jacoco/pull/397
- check that you request dump after actual execution of code/tests
- dump Ant task has option to "reset" data, so check that you don't
accidentally do a dump multiple times, where one of them performs reset
- check that you instruct JaCoCo agent to instrument proper classes,
e.g. by completely removing "includes" option, also there is an option
"classdumpdir" which can be used to see which classes were instrumented
- etc

As a general advice in investigations of problems - use "divide and
conquer" principle, i.e. remove factors from equation:

- run locally instead of Jenkins to fully see and control the process
- try to get coverage using "file" mode before trying "tcpserver" mode
- run commands (application start , execution/tests, dump) separately
and manually instead of fully automated Ant script
- etc
Post by Anil Satya
Hello Evgeny,
Thanks a lot for the timely reply. As per your suggestion, these are
JAVA_OPTS=-javaagent:/tools/
jacoco-0.7.6/lib/jacocoagent.jar=includes=com.manh.*:com.logistics.*,destfile=/builds/v2017/lm/deployments/lm/tomcat-ora/distribution/coverage/lmjacoco.exec,output=tcpserver,port=65000
*The connection refused exception is now gone, but the .exec file recieved
only 5 Bytes of data and the sessions tab shows this message:*
Sessions
No session information available.
No execution data available.
[echo] entering dump part
[jacoco:dump] Connecting to MyTCPServer:65000
[jacoco:dump] Dumping execution data to /builds/v2017/lm/deployments/
lm/tomcat-ora/distribution/coverage/lmjacoco.exec
[jacoco:report] Loading execution data file /builds/v2017/lm/deployments/
lm/tomcat-ora/distribution/coverage/lmjacoco.exec
[jacoco:report] Writing bundle 'Code Coverage Report from JaCoCo for LM'
with 3523 classes
[echo] /staging/2017/jenkin-slave/vci-wmlm-17/workspace/LM_2017_
CI_LJO_DAILY_DEPLOYMENT
[copy] Copying 1 file to /staging/2017/jenkin-slave/
vci-wmlm-17/workspace/LM_2017_CI_LJO_DAILY_DEPLOYMENT
[copy] Copying 7307 files to /staging/2017/jenkin-slave/
vci-wmlm-17/workspace/LM_2017_CI_LJO_DAILY_DEPLOYMENT
Looks like I've come very close and I'm doing some small mistake. Can you
please help me out?
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/96bbefe3-a045-44e8-ae4f-ab315d7aeb73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...