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

EJB naming context

Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a newbie in EJB.
I understand that as of EJB 2.0 spec we can use Local and Remote interfaces. It stands clear to me that with Local there's no parameter's serialization, thus better performance 'cause on the same JVM.
when using different JVM's with remote...
If I am on a LAN and I have deployed an EJB using remote interfaces. I do not know the scope of my look up search done by the ejb client (probably a servlet).
I am looking an EJB remote home interface something like this...
Context context = new InitialContext();
Object homeObject = context.lookup("BonusCalculatorHome");
thebonusEJBHome = (bonusEJBHome)
}catch(javax.naming.NamingException ne){
System.out.println("An error ocurred with a NamingException.");
It means that if I am running this code on a servlet on my machine A, and the EJB is deployed on a machine B I can reach it, right? But on which scope? I mean, if the machine B (where ejb deployment) is on the other side of the world, but on a public machine, I will reach it anyway?
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where your program goes to resolve names when using JNDI is determined by parameters used when creating the InitialContext. When you use the default constructor, InitialContext uses properties laid out in a jndi.properties file locally. You can also create your own and pass it to the constructor.
For a machine A to be able to resolve home interfaces bound on a remote JNDI naming service (machine B), you will need to pass InitialContext some additional information so it will look toward machine B to resolve those names. What properties do you need to pass? Well, you should consult the documentation of your JNDI naming service, or the server that has it embedded, like JBoss, or whatever application server you are using.
And then I believe you'll be able to do what you want. Somebody pop in here if I'm off on some of this.
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic