[SCJP2, SCWCD1.3, SCBCD]
[SCJP2, SCWCD1.3, SCBCD]
[SCJP2, SCWCD1.3, SCBCD]
SCJP, SCWCD, SCBCD, OCA J8
SCJP 1.4(98%)<br />SCBCD1.3 (100%)<br />SCWCD 1.4 (93%)(w/o prep..n)
[SCJP2, SCWCD1.3, SCBCD]
ven u r looking from an ejb, the container always starts searching from the subcontext java:comp/env in the JNDI tree
SCJP, SCWCD, SCBCD, OCA J8
SCJP 1.4(98%)<br />SCBCD1.3 (100%)<br />SCWCD 1.4 (93%)(w/o prep..n)
Context ctx = new InitialContext();
Context subCtx = (Context)ctx.lookup("java:comp/env");
System.out.println("env value of name ==="+subCtx.lookup("name"));
Context ctx = new InitialContext();
Object obj = ctx.lookup("java:comp/env/ejb/SLSBLocal");
and ven i try 2 use without java:comp/env/ its gives me namingexce..n
SCJP, SCWCD, SCBCD, OCA J8
Originally posted by Keerthi P:
If you use some arbitrary string "Accounts", the lookup will be performed under subscontext "Accounts" from the root.
[SCJP2, SCWCD1.3, SCBCD]
When you have a resource ref or ejb ref or env entries or resource env refs in the deployment descriptor for an EJB, the container "binds" them to java:comp/env because these references are 'this' bean's own references. And since java:comp/env namespace is a bean's own private space, it makes sense for the container to bind the above references to this namespace so that other beans cannot access them. So it is apt to say that the container "binds" the refered objects to java:comp/env namespace rather than 'container performs lookup in java:comp/env'.
SCJP 1.4(98%)<br />SCBCD1.3 (100%)<br />SCWCD 1.4 (93%)(w/o prep..n)
Friends help you move. Good friends help you move bodies. This tiny ad will help:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|