Java JConsole 远程连接到 JBoss EAP

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25046317/
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-08-10 23:30:03  来源:igfitidea点击:

JConsole remote connection to JBoss EAP

javajbossjmxjconsole

提问by Biscuit128

I am trying to connect to a remote jboss instance running on a server. I am using the following connection URL

我正在尝试连接到在服务器上运行的远程 jboss 实例。我正在使用以下连接 URL

service:jmx:remoting-jmx://90.214.64.170:9999

服务:jmx:remoting-jmx://90.214.64.170:9999

When i do this i get the following 2 errors in the console window

当我这样做时,我在控制台窗口中收到以下 2 个错误

enter image description here

enter image description here

After selecting insecure i am presented with this

选择不安全后,我会看到这个

enter image description here

enter image description here

I have, prior to connecting via jconsole also gone to the bin directory of my jboss server and run ./jconsole.shwhich outputs the following to the command line

我已经,在通过 jconsole 连接之前也转到了我的 jboss 服务器的 bin 目录并运行./jconsole.sh它向命令行输出以下内容

CLASSPATH /usr/bin/java/jdk1.8.0_11/lib/jconsole.jar:/usr/bin/java/jdk1.8.0_11/lib/tools.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/remoting-jmx/main/remoting-jmx-1.1.2.Final-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/remoting3/main/jboss-remoting-3.2.18.GA-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/logging/main/jboss-logging-3.1.2.GA-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/xnio/main/xnio-api-3.0.7.GA-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/xnio/nio/main/xnio-nio-3.0.7.GA-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/sasl/main/jboss-sasl-1.0.3.Final-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/marshalling/main/jboss-marshalling-1.4.2.Final-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/marshalling/river/main/jboss-marshalling-river-1.4.2.Final-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/as/cli/main/jboss-as-cli-7.3.0.Final-redhat-14.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/staxmapper/main/staxmapper-1.1.0.Final-redhat-2.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/as/protocol/main/jboss-as-protocol-7.3.0.Final-redhat-14.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/dmr/main/jboss-dmr-1.2.0.Final-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/as/controller-client/main/jboss-as-controller-client-7.3.0.Final-redhat-14.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/threads/main/jboss-threads-2.1.1.Final-redhat-1.jar

I am not sure what else i can try (having also opened port 9999) to get this to work, does anyone have any advice or hints that might help resolve this?

我不确定我还能尝试什么(也打开了端口 9999)来让它工作,有没有人有任何可能有助于解决这个问题的建议或提示?

Thanks

谢谢

EDIT

编辑

Having modified my standalone.conf file to this

将我的 standalone.conf 文件修改为此

#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true"
   JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9999"
   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
else
   echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
fi

I am still unable to connect - with the same errors as above

我仍然无法连接 - 出现与上述相同的错误

采纳答案by Biscuit128

I have found the answer - well at least a solution.

我找到了答案——至少是一个解决方案。

Having read through the new JBOSS release notes herefor EAP 6.3 I found the following;

通过新的JBOSS发行说明看了这里的EAP 6.3我发现下面的;

Restored ServiceMBean Helper Classes The org.jboss.as.system-jmx module has been introduced to restore helper classes available in earlier versions of JBoss EAP that assist users in creating MBeans.

恢复的 ServiceMBean 助手类 org.jboss.as.system-jmx 模块被引入来恢复 JBoss EAP 早期版本中可用的助手类,这些助手类可以帮助用户创建 MBean。

What we did was deploy a new standalone instance - clean install of 6.3 and then followed this guide;

我们所做的是部署一个新的独立实例 - 全新安装 6.3,然后按照本指南进行操作;

https://planet.jboss.org/post/jmx_connections_to_jboss_as

https://planet.jboss.org/post/jmx_connections_to_jboss_as

We needed no optional parameters to be added, no modifications to standalone.sh and no modifications for standalone.xml.

我们不需要添加可选参数,不需要修改standalone.sh,不需要修改standalone.xml。

I see someone has 5 up votes for an incorrect answer - is this just so the bounty is awarded?!

我看到有人对错误的答案投了 5 票——这就是赏金被授予的原因吗?!

回答by dugshnay

I believe for remote connections you have to create an Application Realm user (Using add-user.sh. I answered yes to the question as to whether this would be used for remote server connections or EJB remoting user, though I'm unsure that was strictly necessary).

我相信对于远程连接,您必须创建一个应用程序领域用户(使用 add-user.sh。我对这个问题是否将用于远程服务器连接或 EJB 远程处理用户的回答是肯定的,尽管我不确定那是绝对必要)。

Then use those credentials to connect with jconsole.

然后使用这些凭据与 jconsole 连接。

My experience with this also is isolated to remote connections to EAP 6.2.4 running in domain mode. I can only hope remote connections to a standalone server would be the same. It's unclear which you're using here.

我在这方面的经验也与在域模式下运行的 EAP 6.2.4 的远程连接隔离。我只能希望到独立服务器的远程连接是一样的。目前还不清楚你在这里使用的是哪个。

I also changed it so I could use port 4447 by issuing this command in the CLI: /profile=ha/subsystem=jmx/remoting-connector=jmx:add(use-management-endpoint=false)

我还更改了它,以便我可以通过在 CLI 中发出以下命令来使用端口 4447:/profile=ha/subsystem=jmx/remoting-connector=jmx:add(use-management-endpoint=false)

And it doesn't apply to your issue as it appears you're using JDK 8, but I believe JDK 7 or higher is required (for jconsole).

它不适用于您的问题,因为您似乎使用的是 JDK 8,但我相信需要 JDK 7 或更高版本(对于 jconsole)。

Hope something here helps!

希望这里有帮助!

回答by SANN3

Follow the instructions mentioned below to enable remote JMX monitoring in JBoss

按照下面提到的说明在 JBoss 中启用远程 JMX 监控

JBoss 4.2.3.GA

JBoss 4.2.3.GA

Modify run.conf file available in bin directory of JBoss and add below lines-

修改 JBoss 的 bin 目录中的 run.conf 文件并添加以下行-

JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=<PORT>"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
JAVA_OPTS="$JAVA_OPTS -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl"

JBoss 5.1.0.GA

JBoss 5.1.0.GA

JMX port cannot be configured in JBoss 5.1 due to an existing bug (https://issues.jboss.org/browse/JBAS-6185) in JBoss which has been fixed in JBoss 6.0 version.

由于JBoss 中存在已在 JBoss 6.0 版本中修复的错误 ( https://issues.jboss.org/browse/JBAS-6185),因此无法在 JBoss 5.1 中配置 JMX 端口。

JBoss 6.1.0.Final

JBoss 6.1.0.Final

Modify run.conf file available in bin directory of JBoss and add below lines-

修改 JBoss 的 bin 目录中的 run.conf 文件并添加以下行-

JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
JAVA_ARGS="$JAVA_OPTS -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl"
JBOSS_CLASSPATH="../lib/jboss-logmanager.jar"

JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=<PORT>"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
JAVA_OPTS="$JAVA_OPTS -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl"
JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=<IP_ADDRESS>"

JBoss 7.1.1.Final

JBoss 7.1.1.Final

Modify standalone.conf file available in bin directory of JBoss and add below lines-

修改 JBoss 的 bin 目录中的 standalone.conf 文件并添加以下几行 -

JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=<PORT>"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=<IP_ADDRESS>"
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p:../modules/org/jboss/logmanager/main/jboss-logmanager-1.2.2.GA.jar  -Xbootclasspath/p:../modules/org/jboss/logmanager/log4j/main/jboss-logmanager-log4j-1.0.0.GA.jar -Xbootclasspath/p:../modules/org/apache/log4j/main/log4j-1.2.16.jar"
JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=org.jboss.logmanager"

NOTE: Modify and according to your requirements.

注意:修改并根据您的要求。

Reference:

参考:

https://community.jboss.org/wiki/JBossMBeansInJConsole

https://community.jboss.org/wiki/JBossMBeansInJConsole

http://abh1sh3k.blogspot.in/2013/12/jmx-configuration-in-different-versions.html

http://abh1sh3k.blogspot.in/2013/12/jmx-configuration-in-different-versions.html

回答by imTachu

Ok... This was really an issue for me and is important for you to know that if you jave JConsole and JBoss on different machines, the JConsole that comes with Java DOES NOT WORK... You have to download a copy of JBoss on the machine you have JConsole and on the bin folder look for the jconsole.batfile.

好的...这对我来说真的是一个问题,并且让您知道如果您在不同的机器上使用 JConsole 和 JBoss ,Java 附带的 JConsole不起作用...您必须下载 JBoss 的副本您拥有 JConsole 的机器并在 bin 文件夹中查找jconsole.bat文件。

I took it from here: http://www.java-redefined.com/2014/02/jboss-7-with-jconsole.html

我从这里拿了它:http: //www.java-redefined.com/2014/02/jboss-7-with-jconsole.html

回答by Ispanico

JBoss 6.2.0 EAP

JBoss 6.2.0 EAP

To use JConsole with JBoss 6.2 EAP you must start it adding some JARs to the classpath.

要在 JBoss 6.2 EAP 中使用 JConsole,您必须启动它,在类路径中添加一些 JAR。

In the directory /jboss-eap-6.2/bin/clientthere is a README file that says:

在目录中/jboss-eap-6.2/bin/client有一个 README 文件,上面写着:

TO RUN JCONSOLE:

运行 JCONSOLE:

jconsole -J-Djava.class.path=<PATH TO jconsole.jar>;<PATH TO tools.jar>;<PATH TO jboss-cli-client.jar>

回答by aazeem

For version 6.1, Make sure you have added the correct portoffset to your default portnumber, 9999 is default, so remote process should work with:

对于 6.1 版,请确保已将正确的 portoffset 添加到默认端口号,默认值为 9999,因此远程进程应使用:

service:jmx:remoting-jmx://90.214.64.170:(offsetnumber+9999)

Apparently, this got resolved in version 6.2

显然,这在 6.2 版中得到了解决