aspose file tools*
The moose likes Websphere and the fly likes EJB - JNDI lookups across 2 app server on the same machine? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "EJB - JNDI lookups across 2 app server on the same machine?" Watch "EJB - JNDI lookups across 2 app server on the same machine?" New topic
Author

EJB - JNDI lookups across 2 app server on the same machine?

Joe Boxer
Greenhorn

Joined: Oct 23, 2003
Posts: 15
Within WSAD (could be WAS as well) 2 app servers created to run independently (the same machine, no clustering, just to servers). Server1 with an enterprise application A, Server 2 with an enterprise application B. B uses EJBs from A.

Server1: the port for the naming service is 2809
Server2: the port for the naming service is 2810

JNDI of one of the EJBs running on A is e.g. A_abc

Within application B in order to resolve the A_abc I do following

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");

env.put(Context.PROVIDER_URL, "iiop://localhost:2809");

Trying to lookup the bean, I fail. Am not quite sure what to pass to the lookup method.

dumpNameSpace.bat � port 2809 for the Server1 gives back

(top)/nodes/localhost/servers/server1/A_abc

How do I look up the bean on Server1 within its naming space from the Server2

initialContext.lookup("nodes/localhost/servers/server1/A_abc�);
initialContext.lookup("cell/nodes/localhost/servers/server1/A_abc�);

do not work.



Funnily the beans bound to the names space of the Server2 have the same prefix

35 (top)/nodes/localhost/servers/server1/B_xyz

Why does the lookup cannot resolve the name, since I (I guess I did) initialised the InitialContext correctly?

What do I do wrong?

thanks for any help
Joe
Jorge Villalobos
Greenhorn

Joined: Nov 12, 2004
Posts: 1
Some people and I were having the same problem and the solution we came up with (accidentally, by the way) was to replace localhost with the machine's IP address when specifying the URL, both in the ORB config in the server and on the value passed to the env variable.
Apperently the app server assumes localhost means that both EARs are located on the same app server.
Hope this helps,
[ November 12, 2004: Message edited by: Jorge Villalobos ]

----------------------<br />Firefox 1.0. Rediscover the Web.<br /><a href="http://www.mozilla.org/products/firefox/" target="_blank" rel="nofollow">http://www.mozilla.org/products/firefox/</a>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: EJB - JNDI lookups across 2 app server on the same machine?