3 Replies Latest reply on Jan 18, 2007 9:06 AM by j i

    How to connect to remote server correctly

    Feng Huang Newbie

      My code is:
      try {
      Hashtable env = new Hashtable();
      env.put(Context.PROVIDER_URL, this._url);
      InitialContext ctx = new InitialContext(env);

      // get MBeanServer
      MBeanServerConnection mbs = (MBeanServerConnection) ctx.lookup("jmx/invoker/RMIAdaptor");
      } catch (Exception e) {

      It is running on localhost jboss server, it is used to connect to a remote jboss server.

      The problem is:
      If the remote jboss server is running, it is ok.
      But if the remote server is down, it will get the local default context and then lookup in this context.

      What I want is that if the remote server is down, it should go into the exception.
      How to do it?
      Or how to change the config in jboss and let it not to get the default context for my program if the remote server is down.