G
gk
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
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 ?
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
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 ?