This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic