java 在 Jetty 上启用远程 JMX

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5297462/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 10:28:42  来源:igfitidea点击:

Enable remote JMX on Jetty

javajettyjmx

提问by Luciano Fiandesio

I'm trying to enable remote JMX on a Jetty 6.1.26 instance running on Windows. I have tried several approaches, but the result is always the same:

我正在尝试在 Windows 上运行的 Jetty 6.1.26 实例上启用远程 JMX。我尝试了几种方法,但结果总是一样的:

When I try to connect from jconsole to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmiI got "connection refused".

当我尝试从 jconsole 连接到service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi“连接被拒绝”时。

I have found several guides on the internet, but no one seems to help. Please note that I'm running Jetty standalone, from the "Jetty-Service.exe" wrapper.

我在互联网上找到了几个指南,但似乎没有人提供帮助。请注意,我从“Jetty-Service.exe”包装器独立运行 Jetty。

It would be great if someone could suggest a way to enable remote JMX on jetty.

如果有人可以提出一种在码头上启用远程 JMX 的方法,那就太好了。

回答by Luciano Fiandesio

I'm answering my own question.

我在回答我自己的问题。

This is the way I have found to start Jetty with JMX enabled:

这是我发现在启用 JMX 的情况下启动 Jetty 的方式:

java
    -Dcom.sun.management.jmxremote
    -Dcom.sun.management.jmxremote.ssl=false 
    -Dcom.sun.management.jmxremote.authenticate=false 
    -Dcom.sun.management.jmxremote.port=1099 
-jar start.jar etc/jetty-jmx.xml etc/jetty.xml

回答by omerkudat

Which Jetty is this? I had to do the same yesterday. First, I had to uncomment etc/jetty-jmx.xml in the start.ini file (installation root.) Then I had to add the same jmx system properties that you mentioned in your comment above. Unless you edit start.ini, you will not see the Jetty-specific MBeans, but you will be able to connect via jConsole.

这是哪个码头?我昨天也不得不这样做。首先,我必须在 start.ini 文件(安装根目录)中取消对 etc/jetty-jmx.xml 的注释。然后我必须添加您在上面的评论中提到的相同 jmx 系统属性。除非您编辑 start.ini,否则您将看不到特定于 Jetty 的 MBean,但您将能够通过 jConsole 进行连接。