2 Replies Latest reply on Feb 24, 2004 10:33 AM by Marek Neumann

    Example for remote call of JMX method

    Marek Neumann Novice

      I am trying to realize a system which can detect other JBoss servers in the network and call JMX methods on the detected MBean server. I decided to use the new JBoss Remoting Framework which is now in 3.2.

      Detection via multicast and JNDI works fine. I aim at calling a method of a particular mbean on the server and I am a bit lost. As I read in the docu, org.jboss.remoting.Client can be used for doing that. Is this correct or is there another (better) way?

      Question: how can I pass the JMX ObjectName to the call:

      Object ret = client.invoke(new NameBasedInvocation(method, new Object[]{param}, new String[]{String.class.getName()}), null);

      E.g. how would the call look like if the method "shutdown()" from jboss.system:type=Server should be called?

      Thanks a lot,


        • 1. Re: Example for remote call of JMX method
          Tom Elrod Master

          Not positive, but looks like you must be adding yourself as a notification listener directly to the detector and handling the notification for a new detection? This was not the original intent of the notifications from the detector (really just added for the DetectorUtil class), but should work for what you are doing (most people use the MBeanTracker since makes the code a little easier).

          So I wrote a simple test and found that there is a bug with this. I have fixed the bug and checked it in along with the simple test case. If you get the latest code at the 3.2 branch (the tag is Branch_3_2 on the jboss-3.2 module), will see there is a new directory under jmx-remoting/test/org/jboss/test/mx/remoting called simple. In this will be a readme.txt file with the sample code. Should have everything you need to get started.

          I should also note that this current implementation is not from the JSR 160 JMX Remoting specification (something we are working on). However, all the code should work for any remote JMX calls you need to make.

          Let me know if you have any other questions.



          • 2. Re: Example for remote call of JMX method
            Marek Neumann Novice

            After your fix it is working now.