users@glassfish.java.net

InitialContext on remote server

From: <glassfish_at_javadesktop.org>
Date: Thu, 04 Dec 2008 07:32:24 PST

I can use this code in a stand alone java client to access a Glassfish server and perform JNDI lookups

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
env.put("org.omg.CORBA.ORBInitialPort", "3967");
env.put("org.omg.CORBA.ORBInitialHost", "server2");
Context ic = new InitialContext(env);

However, if I place this code inside an EJB or Lifecycle module, it does not work. It seems the container ignores the InitialHost/InitialPort properties and performs a local JNDI lookup.

Is it possible to access a remote server/application? If so, please explain? I have seen other posts mentioning the use of custom/external JNDI resource but they do not contain enough detail to implement. In addition, I would think there is a better way to add a remote server to you "system" than to create resources - database lookup for one.

Thanks,

Joe
[Message sent by forum member 'janchj' (janchj)]

http://forums.java.net/jive/thread.jspa?messageID=320075