May be too much of information provided in my original post is causing confusion, so I will try to keep my questions short and brief.
Assuming the original setup as posted in my original post, i.e I have only ejb-jar.xml (no vendor specific descriptor files like jboss.xml or for some other vendor) and I have <ejb-name>HelloWorld</ejb-name>
Question 1) - If I had to call the enterprise bean from a standalone client not deployed along with the enterprise beans in a container, do I look up the stub for home using lookup("HelloWorld") or lookup("java:comp/env/ejb/HelloWorld"). Because lookup("HelloWorld") seems to be working for me, when I try the other option, I get exceptions like comp not bound. Could this be because of "In the absence of a jboss.xml specification of the jndi-name for an EJB, the home interface is bound under the ejb-jar.xml ejb-name value" ?
Question 2) I did see examples in many posts flooded in internet, where they used the lookup against
java:comp/env/ejb/HelloWorld and it seems to be working fine for them. Is that because, they used a different vendor not like JBoss 4.0 or, they would have looked up like this, from
servlet or another component deployed on same jvm as that of enterprise beans as one single ear package.
Question 3) When I looked in JMX console, I noticed HellowWorld under Global JNDI namespace. Is that because, I did not vendor specific descriptor file like jboss.xml. If I had used Jboss.xml, do I need to specify like java:comp/env/ejb/HelloWorld specifically in ejb-jar.xml or jboss.xml. I have tried with different combinations and ended up with different exceptions.
Question 4) When do I use the lookup as
InitialContext iniCtx = new InitialContext();
Context ejbCtx = (Context) iniCtx.lookup("java:comp/env/ejb");
ShoppingCartHome home = (ShoppingCartHome) ejbCtx.lookup("ShoppingCartHome");
vs
InitialContext iniCtx = new InitialContext();
ShoppingCartHome home = (ShoppingCartHome) iniCtx.lookup("ShoppingCartHome");
Please help me understand this.
Thanks