0 Replies Latest reply on Dec 10, 2012 10:22 AM by icemanltd

    Connecting to remote JMX server

    icemanltd Newbie

      I have an application deployed in JBoss AS 7.1.1 and I would like to connect to a remote JMX server. The the following code seems to work fine standalone.

       

       

                 JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-root");

                  Hashtable<String, String[]> env = new Hashtable();

                  String[] credentials = new String[]{"smx", "smx"};

                  env.put("jmx.remote.credentials", credentials);

                  JMXConnector jmxc = JMXConnectorFactory.connect(url, env);

                  MBeanServerConnection server = jmxc.getMBeanServerConnection();

       

      But when I execute this code within JBoss I get the following error.

      java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException: rmi://localhost:1099/karaf-root -- service jboss.naming.context.java.rmi:.localhost:1099.karaf-root

       

      which is ...

       

      Caused by: javax.naming.NameNotFoundException: rmi://localhost:1099/karaf-root -- service jboss.naming.context.java.rmi:.localhost:1099.karaf-root