Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Joe Boxer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic