[jboss-user] [JNDI/Naming/Network] - Remote JNDI connects locally

normann do-not-reply at jboss.com
Wed Nov 26 12:52:08 EST 2008


I have a remote session bean running on one JBoss 4.2.3 + JDK 6 server and would like to connect to it from code running in another JBoss 4.2.3 + JDK 6 server.

My suggestion to doing this is:

Hashtable environment = new Hashtable();
  | environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  | environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces");
  | environment.put(Context.PROVIDER_URL, "jnp://192.168.1.10:1099");
  | InitialContext context = new InitialContext(enviroment);
  | Object bar = context.lookup("foo");

Even though I have asked to connect to the JNDI server running at 192.168.1.10 by providing the PROVIDER_URL, the lookup seems to be performed on the JNDI server running on the same server as the code (i.e. localhost), and therefore it cannot find what I'm looking for. My conclusion is that PROVIDER_URL is ignored or that something overrides it.

It think that my setup is very common, and since I can't make it work, there must be some fundamental thing about JNDI that I don't know about, so please, could someone enlighten me? Thanks up front. :-)

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

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



More information about the jboss-user mailing list