1 Reply Latest reply on Aug 4, 2010 7:30 PM by 843798

    Access remotely to JMX server


      I'm a newbie in JMX (as well as in Java in general).. hope you can help me.
      I'm trying to write a JMX server that manage a simple MBean and access it remotely from a JMX client.
      Here is my JMX server code:
      * Create MBean server
      public void createMBeanServer() {
      _mbs = MBeanServerFactory.createMBeanServer();

      * Register the server MBeans.
      private void registerServerMBeans() {
      MBeanNameA = new ObjectName("TEST:type=InternalA");
      InternalA mbeanA = new InternalA();
      _mbs.registerMBean(mbeanA, MBeanNameA);

      * Start RMI connector
      private void startRMIConnector(){

      HashMap<String, Object> env = new HashMap<String,Object>();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory");
      env.put(Context.PROVIDER_URL, "rmi://localhost:8889");
      url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8889/server");

      The first question is: How can I make this JMX server remotely reachable?
      The second question is how to write the client's side code in order to connect to the JMX server?

      Any help is appreciated.

      Thanks is advanced!

        • 1. Re: Access remotely to JMX server
          Hi hadardar

          welcome to JMX! :)

          There is plenty of documentation(unfortunately some obsolete) around the net to accomplish what you are asking for. I strongly recommend you to start from the official JMX page from the Java documentation page. Read the overview and the tutorial page


          Further at the examples section:

          you will find plenty of examples(downloadable also) of using the RMI connectors to allow remote access to the MBeanServer

          Further, because as you said you are a beginner in Java, keep an eye of the The Java Tutorial Page for JMX (They also provide specialized trails for different aspects of the Java Programming Language)


          Hope that helps,


          Edited by: cvasilak@java on Aug 4, 2010 10:29 PM