1 Reply Latest reply on Jun 2, 2007 1:02 PM by jaikiran pai

    Remote JNDI Lookup on Remote MBean Server

    Richard Price Newbie

      I am trying to get a server connection to a remote MBean Server. I am using the following code:

      MBeanServerConnection server = null;

      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, jndiUrl);

      InitialContext ic = new InitialContext(env);
      server = (RMIAdaptor) ic.lookup("jmx/invoker/RMIAdaptor");

      When running the code on one of the remote servers I get a java.lang.ClassCastException on the lookup which is strange because RMIAdaptor actually extends the MBeanServerConnection. I think it is something else. When I run this code on my desktop against my local machine it works fine. But when I run this code on my local machine against a remote server I get a javax.nameing.CommunicationException.

      Any help on how to query the Mbeans on a remote machine would be helpful?

      FYI this code worked fine in all aspects with jboss 4.0.3 it is 4.0.4 that is giving me the problems.