This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help needed understanding Ejb and Jndi

 
Murad Iqbal
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm quite new to ejb and jndi. I have read the tutorial and so far am ok in grasping the concept but the big thing i fail to understand is that how can an ejb binded at my machine be referenced from other machine without me telling them? How will a machine in my network or on the internet know i've got this ejb binded on this machine? will they write some fully qualified ip address or dns name before the ejb reference to access it? How? i'm confused.


Cheers,
Murad.
 
Yuan Ye
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the machine information is specified in the environment object when you create a InitialContext from it. (including provider url)
However sometime you want to get the a local jndi name, whereas you can new InitialContext() directly, by default, it looks up the localhost.
 
Murad Iqbal
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and when do i create an environment object? I am not sure when that is done, i just call initial context in the beginning.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Javadoc of InitialContext has a very good explanation about this. Also, InitialContext has 3 constructors, one of them being the Default Constructor (which is used often) and one more being:



You can pass environment information through this constructor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic