I was trying the javaagent way. The output=tcpserver approach worked well, but output=file and output=tcpclient didn't seem to work. For output=file, the file was created but was always empty. For output=tcpclient, I used 'netcat -l -p <port>' as the tcpserver but nothing was received.
I searched and found that, only when the JVM was terminated, will the execution result be written to the local file or sent to the remote tcp server. So I stopped my tomcat after the tests were executed. But still no content was written to the file or sent to the tcp server.
Anything wrong? Do we need to a particular method to terminate tomcat/JVM? What if I simply "kill -9" to kill tomcat?
Here's the JAVA_OPTS I added to catalina.sh for the two approaches, respectively:
JAVA_OPTS="-javaagent:/data/project/jacoco/lib/jacocoagent.jar=includes=*,output=file,destfile=/data/project/result/xyz,append=true,jmx=true"
JAVA_OPTS="-javaagent:/data/project/jacoco/lib/jacocoagent.jar=includes=*,output=tcpclient,address=127.0.0.1,port=9529"
Any tips would be highly appreciated!
Thanks.
--huafeng
hi,I was trying the javaagent way. The output=tcpserver approach worked well, but output=file and output=tcpclient didn't seem to work. For output=file, the file was created but was always empty. For output=tcpclient, I used 'netcat -l -p <port>' as the tcpserver but nothing was received.
I searched and found that, only when the JVM was terminated, will the execution result be written to the local file or sent to the remote tcp server. So I stopped my tomcat after the tests were executed. But still no content was written to the file or sent to the tcp server.
Anything wrong? Do we need to a particular method to terminate tomcat/JVM? What if I simply "kill -9" to kill tomcat?