• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

client locating the enterprise beans..

 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How does the client actually locate the enterprise beans?. I know it uses JNDI for lookup.. but no where we specify the machine/IP address of the app server ???
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are several ways to do this:

1. u could pass information to the InitialContext constructor (a properties object that contains everything the InitialContext needs to find the server and the starting context).

2. There are several places where JNDI properties can be placed on the client's machine.

In both the cases, the client must be given something - either info for InitialContext constructor, or a properties file. It's different for each vendor's server. pls. check documentation in order to know what the client needs.

The same thing is explained in HFEJB Book.
 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx chandra for u'r reply.

Well, what I got after playing around a little bit was :- If your client is outside your container, then you cannot just do a "java:comp/env" lookup. This is ONLY for beans/classes inside the container. So now you have to create your own InitialContext using :-

java.util.Hashtable env = new java.util.Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL, "corbaloc:iiop:<hostname>:3700");

Context initial = new InitialContext(env);
Object obj = (Object) initial.lookup("/ejb/<bean-jndi-name>");

So, there you specify the machine/ipaddress of the server.

Remember to specify "/ejb" before the jndi name while using lookup.

(just correct me, if I am writing nonsense.... ).
 
Goodbye moon men. Hello tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic