简体   繁体   English

Jacoco jmx转储,连接重置错误

[英]Jacoco jmx dump, Connection reset error

I am running tomcat with a jacoco agent like this: 我正在使用jacoco代理运行tomcat:

-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) . 我知道这是有效的,因为lsof命令列出了88208 TCP localhost:**8001** (LISTEN)

When I run this example code with PORT = 8001; 当我使用PORT = 8001;运行此示例代码PORT = 8001; I get the error: Exception in thread "main" java.net.SocketException: Connection reset 我收到错误: Exception in thread "main" java.net.SocketException: Connection reset

This appears to be an older example from jacoco. 这似乎是jacoco的一个较旧的示例。 Has something changed with that way I need to access the tcp server? 我需要访问tcp服务器的方式有所变化吗? 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. 我还尝试通过其MBeanClient访问jacoco,但是它给了我一个InstanceNotFoundException,当我打印出所有域时,tomcat似乎没有将“ org.jacoco:type = Runtime”列为bean。

Any suggestions for either option? 有任何建议吗? I just need to be able to get a dump file without stopping the server. 我只需要能够在不停止服务器的情况下获取转储文件。

Turns out I needed some more java arguments when starting my server: 事实证明,启动服务器时我需要更多的Java参数:

-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. 没有这些,JMX就无法将jacoco视为我的本地主机上的bean。

(this also works for glassfish, but they need to be set using <jvm-options> ) (这也适用于玻璃鱼,但需要使用<jvm-options>进行设置)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM