简体   繁体   English

如何配置在我的LAN上运行的Java应用程序?

[英]How can I profile a Java application running on my LAN?

I am trying to profile a Java application running on my LAN from JVisualVM. 我正在尝试从JVisualVM剖析在LAN上运行的Java应用程序。

However, when I start my program with arguments like: 但是,当我使用类似这样的参数启动程序时:

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=9000
-Dcom.sun.management.jmxremote.ssl=false

I am unable to connect through JVisualVM, with JMX or jstatd. 我无法通过JVisualVM,JMX或jstatd连接。

9000 is forwarded, of course, and the server uses Ubuntu. 当然,将转发9000,并且服务器使用Ubuntu。

By default, JMX will open another random port besides the one specified with -Dcom.sun.management.jmxremote.port . 默认情况下,除了-Dcom.sun.management.jmxremote.port指定的端口外,JMX将打开另一个随机端口。 Since Java 7u25, you can set this port to a fixed value: 从Java 7u25开始,您可以将此端口设置为固定值:

-Dcom.sun.management.jmxremote.rmi.port=1234

You may set it to the same port as -Dcom.sun.management.jmxremote.port . 您可以将其设置为与-Dcom.sun.management.jmxremote.port相同的端口。 See this answer for details. 有关详细信息,请参见此答案

If you are still having problems with the connection, try debugging it with JConsole. 如果连接仍然有问题,请尝试使用JConsole对其进行调试。 See the answers to this question for details. 有关详细信息,请参见此问题的答案。

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

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