9 Replies Latest reply on Mar 23, 2012 8:20 AM by dlofthouse

    How to connect to MBean Server in JBoss 7.1.0

    nestorjb

      Hi

       

      I need to connect to the MBean Server in JBoss 7.1.0 from an external application. I know there is a new architecture for the connection using the following URL:

       

      service:jmx:remoting-jmx://<host>:9999/jmxrmi

       

      But I need to set a particular provider and add some jboss libraries to make this work. Does anybody know what is the provider name and the libraries, if possible with the Maven location?

       

      Regards,

       

      Néstor Boscán

        • 1. Re: How to connect to MBean Server in JBoss 7.1.0
          dlofthouse

          The provider for the remoting-jmx URL should be located automatically by searchign the classpath but FYI the provider is 'org.jboss.remoting3.jmx.RemotingConnectorProvider'.

           

          Regarding the classes, if you just want a single jar then {jboss.home}/bin/client/jboss-client.jar should be sufficient.

           

          For a maven dependency you need : -

           

          https://repository.jboss.org/nexus/content/groups/public-jboss/org/jboss/remoting3/remoting-jmx/1.0.0.Final/

           

          However please note that from 7.1.1.Final this will change to: -

           

          https://repository.jboss.org/nexus/content/groups/public-jboss/org/jboss/remotingjmx/remoting-jmx/1.0.2.Final/

           

          The provider then becomes 'org.jboss.remotingjmx.RemotingConnectorProvider'

          • 2. Re: How to connect to MBean Server in JBoss 7.1.0
            nestorjb

            WOW Thanks a lot

             

            I added the library and got that It couldn't find a XNIO provider so I added xnio-nio.jar and it worked. But now I'm getting:

             

            Authentication failed: all available authentication mechanisms failed

             

            In JBoss 6.1.0 the connection was open. Which authencation must I set to make it work?

             

            Regards,

             

            Néstor Boscán

            • 3. Re: How to connect to MBean Server in JBoss 7.1.0
              dlofthouse

              You are connecting to port 9999 so I assume this is standalone mode (let me know if this is not correct)

               

              This means you will need to specify the username and password of a user in the management realm - if you have not already added one you can use the add-user.sh script in the bin folder of the AS installation.

               

              What is the actual client you are using to connect?  At the moment the username / password handling is modelled on how jconsole supply these when establishing a connection.

              • 4. Re: How to connect to MBean Server in JBoss 7.1.0
                nestorjb

                Yes I did that with this code:

                 

                env.put(JMXConnector.CREDENTIALS, new String[] { username, password });

                jmxConnector = JMXConnectorFactory.newJMXConnector(serviceUrl, env);

                 

                But I'm still getting the same error. The user and password was created using add-user.sh and it works with the Administration Console.

                • 5. Re: How to connect to MBean Server in JBoss 7.1.0
                  nestorjb

                  I changed the code from:

                   

                              jmxConnector = JMXConnectorFactory.newJMXConnector(serviceUrl, env);

                              jmxConnector.connect();

                   

                  to


                              jmxConnector = JMXConnectorFactory.connect(serviceUrl, env);

                  And I think it passes the login fase but now I'm getting:

                   

                  Operation failed with status WAITING

                  Somewhere I read that I should change in standalone.xml any reference to 127.0.0.1 to the IP of the server but I'm still getting the same error.

                  • 6. Re: How to connect to MBean Server in JBoss 7.1.0
                    nestorjb

                    I fix the URL. I had to take out the /jmxri at the end. Now I'm getting:

                     

                    RuntimeException: Could not find a marshaller factory for river marshalling strategy

                    This looks like a library is missing

                    • 7. Re: How to connect to MBean Server in JBoss 7.1.0
                      dlofthouse

                      The easiest jar to use would be the one under bin/client of your AS7 installation as that should contain everything you need - alternatively it sounds like you are missing the jboss-marshalling-river-1.3.11.GA.jar which can be found within the modules structure.

                      • 8. Re: How to connect to MBean Server in JBoss 7.1.0
                        nestorjb

                        Yes with that library worked. So to this are the dependencies that I had to use to make the connection work:

                         

                        <dependency>

                        <groupId>javax.management</groupId>

                        <artifactId>jmxri</artifactId>

                        <version>1.2.1</version>

                        <scope>provided</scope>

                        </dependency>

                        <dependency>

                        <groupId>org.jboss.remoting3</groupId>

                        <artifactId>remoting-jmx</artifactId>

                        <version>1.0.0.Final</version>

                        <scope>provided</scope>

                        </dependency>

                        <dependency>

                        <groupId>org.jboss.xnio</groupId>

                        <artifactId>xnio-nio</artifactId>

                        <version>3.0.0.GA</version>

                        <scope>provided</scope>

                        </dependency>

                        <dependency>

                        <groupId>org.jboss.marshalling</groupId>

                        <artifactId>jboss-marshalling-river</artifactId>

                        <version>1.3.7.GA</version>

                        <scope>provided</scope>

                        </dependency>

                         

                        Regards,

                         

                        Néstor Boscán

                        • 9. Re: How to connect to MBean Server in JBoss 7.1.0
                          dlofthouse

                          I have created the following Jira issue: -

                           

                          https://issues.jboss.org/browse/REMJMX-38

                           

                          For something like this it probably would make more sense for clients to just have a single Remoting JMX dependency without needing to add additional dependencies.