Jacoco jmx转储,连接重置错误 [英] Jacoco jmx dump, Connection reset error

查看:237
本文介绍了Jacoco jmx转储,连接重置错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用像这样的jacoco代理来运行tomcat:

I am running tomcat with a jacoco agent like this:

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

我知道这是有效的

,因为lsof命令列出了88208 TCP localhost:**8001** (LISTEN).

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

这似乎是jacoco的一个较旧的示例.我需要访问tcp服务器的方式发生了什么变化?我还尝试通过其 MBeanClient ,但是它给了我一个InstanceNotFoundException,并且当我打印出所有域时,tomcat并没有将"org.jacoco:type = Runtime"列为bean.

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.

推荐答案

原来,启动服务器时我需要更多的Java参数:

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"

没有这些JMX,我的本地主机上就无法将jacoco视为bean.

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

(这也适用于玻璃鱼,但需要使用<jvm-options>进行设置)

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

这篇关于Jacoco jmx转储,连接重置错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆