如何在我的JVM上激活JMX以便使用jconsole进行访问? [英] How to activate JMX on my JVM for access with jconsole?
问题描述
如何在JVM上激活JMX以便使用jconsole进行访问?
How to activate JMX on a JVM for access with jconsole?
推荐答案
相关文档可在此处找到:
The relevant documentation can be found here:
http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html
使用以下参数启动程序:
Start your program with following parameters:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
例如这样:
java -Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=9010 \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-jar Notepad.jar
-Dcom.sun.management.jmxremote.local.only = false
不一定需要
但没有它,它在Ubuntu上不起作用。这个错误就像
这样:
-Dcom.sun.management.jmxremote.local.only=false
is not necessarily required
but without it, it doesn't work on Ubuntu. The error would be something like
this:
01 Oct 2008 2:16:22 PM sun.rmi.transport. customer .TCPTransport$AcceptLoop executeAcceptLoop
WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=37278] throws
java.io.IOException: The server sockets created using the LocalRMIServerSocketFactory only accept connections from clients running on the host where the RMI remote objects have been exported.
at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(LocalRMIServerSocketFactory.java:89)
at sun.rmi.transport. customer .TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:387)
at sun.rmi.transport. customer .TCPTransport$AcceptLoop.run(TCPTransport.java:359)
at java.lang.Thread.run(Thread.java:636)
请参阅 http://错误。 sun.com/bugdatabase/view_bug.do?bug_id=6754672
还要小心 -Dcom.sun。 management.jmxremote.authenticate = false
哪个
可以让任何人都可以访问,但是如果你只用它来跟踪你的本地机器
上的JVM它就不会无所谓。
Also be careful with -Dcom.sun.management.jmxremote.authenticate=false
which
makes access available for anyone, but if you only use it to track the JVM on
your local machine it doesn't matter.
更新:
在某些情况下,我无法到达服务器。如果我也设置了这个参数,那么这就解决了: -Djava.rmi.server.hostname = 127.0.0.1
In some cases I was not able to reach the server. This was then fixed if I set this parameter as well: -Djava.rmi.server.hostname=127.0.0.1
这篇关于如何在我的JVM上激活JMX以便使用jconsole进行访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!