【发布时间】:2023-03-04 16:03:01
【问题描述】:
我正在尝试使用 Oracle Java Mission control 分析 Java Spring 应用程序。
我将 JVM 连接配置为:localhost:7091
我用java -Dcom.sun.management.jmxremote.rmi.port=7091 -jar app.jar启动了应用程序。
当我尝试启动飞行记录器时,我收到一条错误消息。
Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect]
Could not connect to a JVM at service:jmx:rmi:///jndi/rmi://localhost:7091/jmxrmi. Make sure one is running and that you are using the correct protocol in the Service URL.
有谁知道这个错误的原因是什么?
【问题讨论】:
-
我知道这已经过时了,但对于任何研究此问题的人来说,如果您将主机名从 localhost (127.0.0.1) 更改为外部 IP 地址(通常为 192.168.X.X),它就可以工作。如果您从其他主机访问,还要检查防火墙 (ufw) 和路由器。
标签: java profiling java-mission-control