1 2 Previous Next 20 Replies Latest reply on Jan 24, 2014 12:13 PM by sattishv

    adding alternative jmx connectivity (i.e. JBoss 7)

    John Liptak


      JBoss 7 (Wildfly) does not expose a normal JMX/RMI port.  Instead they expose a remoting-jmx protocol on their management port (usually 9999).

       

      What is the best way to add the necessary classes to JMC so that a connection string like the following will work?

      service:jmx:remoting-jmx://<hostname>:<management port>

        • 1. Re: adding alternative jmx connectivity (i.e. JBoss 7)
          Hirt-Oracle

          The most correct way would probably be to create a plug-in for this for Mission Control. There is an extension point called com.jrockit.mc.rjmx.jmxProtocols explicitly for this purpose. Since I'm guessing this is probably a little bit more work than bargained for, you could try adding the relevant jars to the bootclass path of JMC:

           

          1. To add flags to the JVM, such as -Xbootclasspath/a:, add them after the -vm entry in the jmc.ini file (located next to the jmc launcher in the JDK bin folder). You can also add them by passing the -vm parameter directly to the launcher.

           

          2. There is a file (bin/jconsole.cmd) that wraps the launching of jconsole in the JBoss distribution. From that file you should be able to derive what jar files you need to add, for example modules\org\jboss\remoting3\main\jboss-remoting-3.2.3.GA.jar.

           

          I haven't had the patience to try this, since this is all about custom JBoss stuff.

          1 person found this helpful
          • 2. Re: adding alternative jmx connectivity (i.e. JBoss 7)
            John Liptak

            I'm aware of the jconsole.cmd and I used that to create a startup script for VisualVM, but when I add the JBoss JMX files to the classpath, I still get the following error:

            com.jrockit.mc.rjmx.ConnectionException caused by java.net.MalformedURLException: Unsupported protocol: remoting-jmx

            at com.jrockit.mc.rjmx.internal.RJMXConnection.connect(RJMXConnection.java:554)

            at com.jrockit.mc.rjmx.ServerHandle.doConnect(ServerHandle.java:87)

            at com.jrockit.mc.rjmx.ServerHandle.connect(ServerHandle.java:69)

            at com.jrockit.mc.browser.wizards.ConnectionWizardPage$ConnectionTester.run(ConnectionWizardPage.java:730)

            at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

            Caused by: java.net.MalformedURLException: Unsupported protocol: remoting-jmx

            at javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:357)

            at com.jrockit.mc.rjmx.internal.RJMXConnection.connectJmxConnector(RJMXConnection.java:584)

            at com.jrockit.mc.rjmx.internal.RJMXConnection.establishConnection(RJMXConnection.java:565)

            at com.jrockit.mc.rjmx.internal.RJMXConnection.connect(RJMXConnection.java:544)

            ... 4 more

             

            It's like the URL format isn't getting registered because it's in an OSGi container.  I'm assuming a META-INF/services entry is being ignored.

             

            I'm not adverse to more work than I bargened for, but I've never created an eclipse plug-in before.  Suggestions?

            • 3. Re: adding alternative jmx connectivity (i.e. JBoss 7)
              Hirt-Oracle

              I'll try to whip something together. With some luck I'll have time tomorrow.

              • 4. Re: adding alternative jmx connectivity (i.e. JBoss 7)
                katrinsk

                I managed to connect by creating a hard-coded -Xbootclasspath/a entry in jmc.ini based on the extended classpath that JBoss's jconsole.bat generates. (Easily copy-pasteable in Windows if you set @echo=on in the bat file).

                My jmc.ini now looks something like this (for JBoss EAP 6.1, note that the jar versions needed and their locations differ across versions so you need to get it from jconsole.bat to be sure to get it right).

                Also note that the location of the -Xbootclasspath/a in the jmc.ini is important, it must be under -vmargs. And that the syntax requires a colon ':' after -Xbootclasspath/a, a space character will not work, this was new to me since I hadn't used this option before.

                -startup

                ../lib/missioncontrol/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar

                --launcher.library

                ../lib/missioncontrol/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807

                -vm

                ./javaw.exe

                -vmargs

                -Xbootclasspath/a:[jboss-home]/modules/system/layers/base/org/jboss/remoting-jmx/main/remoting-jmx-1.1.0.Final-redhat-1.jar;[jboss-home]/modules/system/layers/base/org/jboss/remoting3/main/jboss-remoting-3.2.16.GA-redhat-1.jar;[jboss-home]/modules/system/layers/base/org/jboss/logging/main/jboss-logging-3.1.2.GA-redhat-1.jar;[jboss-home]/modules/system/layers/base/org/jboss/xnio/main/xnio-api-3.0.7.GA-redhat-1.jar;[jboss-home]/modules/system/layers/base/org/jboss/xnio/nio/main/xnio-nio-3.0.7.GA-redhat-1.jar;[jboss-home]/modules/system/layers/base/org/jboss/sasl/main/jboss-sasl-1.0.3.Final-redhat-1.jar;[jboss-home]/modules/system/layers/base/org/jboss/marshalling/main/jboss-marshalling-1.3.15.GA-redhat-1-bz-965901.jar;[jboss-home]/modules/system/layers/base/org/jboss/marshalling/main/jboss-marshalling-1.3.16.GA-redhat-1-bz-987256.jar;[jboss-home]/modules/system/layers/base/org/jboss/marshalling/main/jboss-marshalling-1.3.16.GA-redhat-1.jar;[jboss-home]/modules/system/layers/base/org/jboss/marshalling/river/main/jboss-marshalling-river-1.3.16.GA-redhat-1.jar;[jboss-home]/modules/system/layers/base/org/jboss/as/cli/main/jboss-as-cli-7.2.0.Final-redhat-8.jar;[jboss-home]/modules/system/layers/base/org/jboss/staxmapper/main/staxmapper-1.1.0.Final-redhat-2.jar;[jboss-home]/modules/system/layers/base/org/jboss/as/protocol/main/jboss-as-protocol-7.2.0.Final-redhat-8.jar;[jboss-home]/modules/system/layers/base/org/jboss/dmr/main/jboss-dmr-1.1.6.Final-redhat-1.jar;[jboss-home]/modules/system/layers/base/org/jboss/as/controller-client/main/jboss-as-controller-client-7.2.0.Final-redhat-8.jar;[jboss-home]/modules/system/layers/base/org/jboss/threads/main/jboss-threads-2.1.0.Final-redhat-1.jar

                -XX:+UseG1GC

                -XX:+UnlockCommercialFeatures

                -XX:+FlightRecorder

                -Djava.net.preferIPv4Stack=true

                And of course, to connect in JMC, you need to select "Custom JMX service URL" and enter the URL according to the JBoss way, service:jmx:remoting-jmx://<host>:<port>

                • 5. Re: adding alternative jmx connectivity (i.e. JBoss 7)
                  Hirt-Oracle

                  Superb! Thank you! I guess this means I am off the whipping-something-together hook.

                   

                  Kind regards,

                  Marcus

                  • 6. Re: adding alternative jmx connectivity (i.e. JBoss 7)
                    John Liptak

                    I've also got this working, and I've believe I know why my first attempt didn't work.

                     

                    I had copied the jar files from my development location into a single directory and referenced them there.  That does not work.

                     

                    I believe that additional jar's are necessary and are being found from the MANIFEST.MF Class-Path: entries. This means that operations type people will not be able to connect unless they have WildFly installed so that the JBoss module directory exists with the relative directory structure expected by the manifest file.

                     

                    So install and reference, don't copy.

                     

                    Thanks for your help!

                    • 7. Re: adding alternative jmx connectivity (i.e. JBoss 7)
                      1048224

                      I copied all the libraries from jconsole.bat from jboss-eap-6.1 and added in the jmc.ini.


                      Where is Custom JMX service URL in Java Mission Control?


                      I see only "Start JMX Console" option.

                      I am using JMC v5.2. (JDK 7u40)

                      • 8. Re: adding alternative jmx connectivity (i.e. JBoss 7)
                        John Liptak

                        When you create a new connection, there are two fields "Host" and "Port" and below that there is a button "Custom JMX service URL".

                         

                        When you click that button, the two fields change to a single field called "JMX service URL" with a default format of

                        service:jmx:rmi:///jndi/rmi://localhost:7091/jmxrmi

                        and then you change that to

                        service:jmx:remoting-jmx://<hostname>:<port>

                        • 9. Re: adding alternative jmx connectivity (i.e. JBoss 7)
                          1048224

                          Cool. It worked.

                           

                          Comparing JMC to VisualVM and JConsole, what are the benefits/features that we can monitor exclusive to JMC?

                           

                          Except the fancy charts, I do not see any difference in using free tools such as JConsole and VisualVM.

                           

                          What are the decision points to purchase the commercial license of JMC?

                           

                          Thanks for the help.

                          • 10. Re: adding alternative jmx connectivity (i.e. JBoss 7)
                            John Liptak

                            So after being happy with browsing MBeans, I tried flight recording and got the following:

                            Error starting recording on localhost:9999
                            com.jrockit.mc.rjmx.services.flr.FlightRecorderException: Could not start the recording!
                            com.jrockit.mc.rjmx.services.flr.FlightRecorderException: Could not start the recording!
                                at com.jrockit.mc.rjmx.services.flr.internal.FlightRecorderService.start(FlightRecorderService.java:82)
                                at com.jrockit.mc.flightrecorder.controlpanel.ui.jobs.StartRecordingJob.run(StartRecordingJob.java:62)
                                at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
                            Caused by: java.io.IOException: java.lang.ClassNotFoundException: No classloader available
                                at org.jboss.remotingjmx.protocol.v2.ServerProxy$InvokeHandler.handle(ServerProxy.java:911)
                                at org.jboss.remotingjmx.protocol.v2.ServerCommon$MessageReciever$1.run(ServerCommon.java:152)
                                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                                at java.lang.Thread.run(Thread.java:724)
                            Caused by: java.lang.ClassNotFoundException: No classloader available
                                at org.jboss.marshalling.AbstractClassResolver.getClassLoaderChecked(AbstractClassResolver.java:91)
                                at org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:135)
                                at org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:116)
                                at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:893)
                                at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1205)
                                at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
                                at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
                                at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
                                at org.jboss.remotingjmx.protocol.v2.ServerProxy$InvokeHandler.handle(ServerProxy.java:898)
                                ... 4 more
                            

                             

                            I'm assuming that flight recording needs either a specific classloader or classes to be visible to the JMX interface and that's not happening.

                            what classloader or class is flight recording depending on because I assume I will need to add it to the system module in JBoss.

                             

                            Also, local jfr recordings don't contain ANY events, a one minute recording is around 20 kb and the GUI says there are no events.

                            • 11. Re: adding alternative jmx connectivity (i.e. JBoss 7)
                              Hirt-Oracle

                              Did you start the JVM running JBoss with -XX:+UnlockCommercialFeatures -XX:+FlightRecorder?

                              • 12. Re: adding alternative jmx connectivity (i.e. JBoss 7)
                                Hirt-Oracle

                                JBoss must be okay with creating the com.sun.management.MissionControl, com.sun.management:type=MissionControl MBean. It is in the rt.jar though. It, in turn, needs access to the classes in the jre/lib/jfr.jar.

                                1 person found this helpful
                                • 13. Re: adding alternative jmx connectivity (i.e. JBoss 7)
                                  John Liptak

                                  Yes, and I also had to run JMC as admin.

                                  • 14. Re: adding alternative jmx connectivity (i.e. JBoss 7)
                                    Hirt-Oracle

                                    Is all well now, and everything working for you? Just want to make sure.

                                    1 2 Previous Next