[jboss-user] [EJB/JBoss] - How to connect to remote server correctly

colin74 do-not-reply at jboss.com
Fri Nov 17 09:34:08 EST 2006


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

            // get MBeanServer
            MBeanServerConnection mbs = (MBeanServerConnection) ctx.lookup("jmx/invoker/RMIAdaptor");
            mbs.lookup(.....)
        } 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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986840#3986840

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986840



More information about the jboss-user mailing list