栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何在JVM上激活JMX以使用jconsole进行访问?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何在JVM上激活JMX以使用jconsole进行访问?

相关文档可在此处找到:

http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html

使用以下参数启动程序:

-Dcom.sun.management.jmxremote-Dcom.sun.management.jmxremote.port=9010-Dcom.sun.management.jmxremote.rmi.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上运行。该错误将是这样的:

01 Oct 2008 2:16:22 PM sun.rmi.transport. customer .TCPTransport$AcceptLoop executeAcceptLoopWARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=37278] throwsjava.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://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6754672

还应注意-

Dcom.sun.management.jmxremote.authenticate=false
使任何人都可以访问,但是如果仅使用它来跟踪本地计算机上的JVM,则没关系。

更新:

在某些情况下,我无法访问服务器。如果我也设置了此参数,则此问题已解决:-

Djava.rmi.server.hostname=127.0.0.1



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/441819.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号