JNDI : logical vs physical way

Discussion in 'Java' started by gk, Aug 15, 2010.

  1. gk

    gk Guest

    I read from a book ....

    The logical reference (or alias) java:comp/env/ejb/MyBean is the
    recommended approach because you cannot guarantee that the physical
    JNDI location ejb/MyBean you specify in your code will be available .
    Your code wll break if the physical location is changed

    Context ctx = new InitialContext();
    Object ref =ctx.lookup("java:comp/env/ejb/MyBean");



    My Question:
    --------------------

    suppose I write my java code this way

    Context ctx = new InitialContext();
    Object ref =ctx.lookup("ejb/MyBean");// This is physical way


    >>>> Your code wll break if the physical location is changed


    I don't understand this . what change they are talking about ?
    are they talking about if I migrate my code to different server ? but
    I can create a JNDI with the name "ejb/MyBean" there also in the Admin
    server....so, how come the code will break ?

    I don't get the concern here and hence don't understand why logical
    reference is important here ?

    Could you please tell me a case study where the problem could arise ?
    when the code will break ?
     
    gk, Aug 15, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike S
    Replies:
    0
    Views:
    23,076
    Mike S
    Sep 16, 2004
  2. =?Utf-8?B?TWF0dE0=?=

    DAL is physical mapping and BLL logical?

    =?Utf-8?B?TWF0dE0=?=, Dec 7, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    445
    sloan
    Dec 7, 2006
  3. namespace1
    Replies:
    3
    Views:
    930
  4. Replies:
    34
    Views:
    1,791
    Roedy Green
    Jan 15, 2008
  5. Jose Barragan

    Logical Pages vs Physical Pages

    Jose Barragan, Oct 22, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    386
    Gregory A. Beamer \(Cowboy\) - MVP
    Oct 23, 2008
Loading...

Share This Page