Jacoco jmx dump, Connection reset error

萝らか妹 提交于 2019-12-12 04:54:59

问题


I am running tomcat with a jacoco agent like this:

-javaagent:/path_to_jar/jacocoagent.jar=jmx=true,output=tcpclient,port=8001

which I know is working because lsof command lists 88208 TCP localhost:**8001** (LISTEN).

When I run this example code with PORT = 8001; I get the error: Exception in thread "main" java.net.SocketException: Connection reset

This appears to be an older example from jacoco. Has something changed with that way I need to access the tcp server? I have also tried to access jacoco through their MBeanClient, but it gives me an InstanceNotFoundException and appears that tomcat does not have "org.jacoco:type=Runtime" listed as a bean when I print out all of the domains.

Any suggestions for either option? I just need to be able to get a dump file without stopping the server.


回答1:


Turns out I needed some more java arguments when starting my server:

-Dcom.sun.management.jmxremote.port=9999"
-Dcom.sun.management.jmxremote.ssl=false"
-Dcom.sun.management.jmxremote.authenticate=false"

Without these JMX could not see jacoco as a bean on my localhost.

(this also works for glassfish, but they need to be set using <jvm-options>)



来源:https://stackoverflow.com/questions/28776124/jacoco-jmx-dump-connection-reset-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!