the ejb-link value should match the <ejb-name> in your ejb-jar.xml. This is a convenient way to reference the EJBs without referencing the actual JNDI name in jboss-web.xml. In your initial code, you had a ejb-link value of ejb/HelloWorld and there was no entry in your ejb-jar.xml with that ejb-name.
When you changed it to HelloWorld, your ejb-name in ejb-jar.xml was equal to the ejb-link tag in web.xml and so it deployed fine.
If you wanted your original code to work, rename the ejb-name in ejb-jar.xml to be ejb/HelloWorld
Thank you for you help. Do you think you can help explain one more scenario? This time I set the ejb-link tag to "HelloWorld" and the ejb-ref-name tag to "ejb/HelloWorld" in my web.xml file. When I tried to reference the ejb from a Servlet using "ejb/HelloWorld" I got the following exception:
javax.naming.NameNotFoundException: HelloWorld not bound
However, when I referenced the ejb from a Servlet using "HelloWorld" it worked fine. What is going on here? Isn't the Serlvet supposed to use the ejb-ref-name tag for references?
ejb-ref-name is used so that you can reference ur EJBs in a deployment independent way. For e.g. i can jndi my ejb as ABC today but if i had to change it to DEF , i would have to change my code and recompile if i used ABC as the lookup in the servlet code. Instead if i use a reference like ejb/MyBean and map that to "ABC", my chnages would only be limited to the deployment descriptor. Thats the whole point in having ejb-ref-name.
REgarding ur situation, if ur ejb-ref-name is ejb/HelloWorld, you should reference it as
java:comp/env/ejb/HelloWorld from your servlet and it should reference fine if ur ejb-link is HelloWorld and ur ejb-name in ejb-jar.xml is HelloWorld.
Isnt this happening in ur case?
Once I put " java:comp/env/ejb/HelloWorld" into the lookup ot worked fine. Before I was just using "ejb/HelloWorld".