2 Replies Latest reply on May 3, 2005 3:02 AM by Avraham Rosenzweig

    JMX Access from one Jboss instance to another

    Avraham Rosenzweig Newbie


      I'm trying to access a Remote MBean Server from within a We application. Here my code (inside servlet, or JSP):

      Hashtable environment = new Hashtable();
      InitialContext ctx = new InitialContext(environment);
      MBeanServerConnection server = (MBeanServerConnection) ctx.lookup("jmx/invoker/RMIAdaptor");
      ObjectName serverInfo = new ObjectName("jboss.system:type=ServerInfo");
      String hostName = (String) server.getAttribute(serverInfo, "HostName");
      System.out.println("Host: " + hostName);

      On JBoss 4.0.1sp1 I'm getting the local host instead of the remote host as the answer. But if the other server is down, I get an exception. So the JNDI lookup is working.

      On JBoss 4.0.0 we get the correct answer.

      Any clues? Is there something I can do to make this work on 4.0.1sp1?