Originally posted by mini mehta:
i,e ic.lookup("AdviceBean") instead of ic.lookup("java:comp/env/ejb/AdviceBean")
Mini, I wonder if we start thinking about who's calling the lookup method it will become more clear. When you saw look-ups WITHOUT the "java:comp/env", was that client code? When you saw look-ups WITH the "java:comp/env", was that with bean code?
When we deploy, we will likely choose to expose (via RMI) our home bean class. The 'fakey' client code in the book does NOT say "use this RMI server on this machine, this port, and see if you can find something called "Advisor" (it just uses the "everything's local" shortcut - fine, but doesn't show what it's really doing).
Now, if we are another bean (and not a client), and we want to find some other bean..... Universally we know how to find that other bean because we always put all of our beans in the ejb context using using the naming convention that we as the bean developer choose (posted under <ejb-ref-name>
. The deployer might decide to call it something else, but we don't care, we can always find it "our way".
--Dale--