6

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

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

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

enter image description here

After selecting insecure i am presented with this

enter image description here

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

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?

Thanks

EDIT

Having modified my standalone.conf file to this

#
# 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

Biscuit128
  • 5,218
  • 22
  • 89
  • 149
  • 1
    Have you set the appropriate JVM arguments in JBoss to allow it to connect? – JonK Jul 30 '14 at 20:31
  • I have not - which arguments are these? – Biscuit128 Jul 30 '14 at 20:33
  • There's 4 that I can think of: `-Dcom.sun.management.jmxremote`, `-Dcom.sun.management.jmxremote.port=[some port number]`, `-Dcom.sun.management.jmxremote.ssl=[true or false]`, and `-Dcom.sun.management.jmxremote.authenticate=[true or false]`. These need to be included in your JAVA_OPTS, with their values set appropriately. – JonK Jul 30 '14 at 20:35
  • ahhh perfect thanked - could you give me a hint what to provide for the first option? the other 3 are self explanitory :) – Biscuit128 Jul 30 '14 at 20:39
  • There is no value for the first one, it's good as is – JonK Jul 30 '14 at 20:39
  • 1
    You can start JConsole with a `-debug` argument, which might cause it to spit out some more detailed information about why the connection is failing. [This Oracle blog](https://blogs.oracle.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole) has some other troubleshooting steps you could follow. – JonK Jul 30 '14 at 20:54
  • Which version of JBoss you are using ? – SANN3 Aug 13 '14 at 06:57
  • JBoss EAP 6.2 I believe – Biscuit128 Aug 13 '14 at 08:48

6 Answers6

14

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

JBoss 4.2.3.GA

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

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

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 6.1.0.Final

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

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

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

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

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

SANN3
  • 9,459
  • 6
  • 61
  • 97
  • do i need these as well as the others in my original post or just these? – Biscuit128 Aug 13 '14 at 08:41
  • if i add a combination of both i get the following error `Exception thrown by the agent : javax.management.JMRuntimeException: Failed to load MBeanServerBuilder class org.jboss.system.server.jmx.MBeanServerBuilderImpl: java.lang.ClassNotFoundException: org.jboss.system.server.jmx.MBeanServerBuilderImpl` – Biscuit128 Aug 13 '14 at 08:47
  • Add these with other params. Did you added your ip address instead of ? – SANN3 Aug 13 '14 at 09:24
  • yes - added my ip address in place of - i added my local host address (the ip on the internal network 192.168.0.value) opposed to the external ip – Biscuit128 Aug 13 '14 at 09:32
  • I also got that exception. But after adding this params worked. For @ashokramcse also working i think. But i am using JBoss 4.0. – SANN3 Aug 13 '14 at 09:35
  • 2
    none of the above applies to EAP 6.2 as 1) the MBeanServerBuilderImpl is not packaged any more and 2) these are all settings for non eap jboss – Biscuit128 Aug 13 '14 at 11:04
5

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;

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.

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

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.

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

Biscuit128
  • 5,218
  • 22
  • 89
  • 149
  • Ahh, been struggling with this issue for the past few days too. Just upgraded my install to 6.3 and followed the guide you posted. JConsole appears to be working fine now! Thanks. – mchinaloy Aug 14 '14 at 09:57
5

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.bat file.

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

imTachu
  • 3,759
  • 4
  • 29
  • 56
0

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).

Then use those credentials to connect with 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.

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)

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).

Hope something here helps!

dugshnay
  • 19
  • 1
0

JBoss 6.2.0 EAP

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

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

TO RUN JCONSOLE:

jconsole -J-Djava.class.path=<PATH TO jconsole.jar>;<PATH TO tools.jar>;<PATH TO jboss-cli-client.jar>
dev
  • 1,343
  • 2
  • 19
  • 40
Ispanico
  • 57
  • 1
  • 9
0

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:

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

Apparently, this got resolved in version 6.2

aazeem
  • 844
  • 1
  • 12
  • 23