Too many questions, keep it short and sweet.
> I'm able to get EJBs to run on JBoss, but I don't
> completely understand the whole JNDI thing.
> Specifically, what fields match with what other
> fields in other files. An example at this point would
> My client code:
> InitialContext ic = new InitialContext();
> Object objref = ic.lookup("ejb/my_context/MyEJB");
> 1) Sometimes I have to use "java:/comp/env/" and
> sometimes, like above, I don't. Why? When should I
> use one over the other? When _can't_ I use one over
> the other?
java:comp/env is the preferred method for components
inside jboss. They are aliases to the real jndi links (the other
type). Each component has its own copy of java:comp/env
The other bindings outside java:/ are available globally.
java:/ is only available in the same vm
> My jboss-web.xml:
This says java:comp/env/ejb/my_context/MyEJB (ejb-ref-name)
is mapped to ejb/my_context/MyEJB (the real binding)
> 2) I'm guessing that my code must either match
> ejb-ref-name or jndi-name. Which one?
It will work with either.
> 3) ejb-ref-name and jndi-name can be different,
> right? Why would one do that?
They are at your discretion.
> 4) I don't have to use java:/comp/env in any of the
> xml files because that's already assumed, right?
> My web.xml:
It is the prefix to all ref-names
> Ok, I know that the ejb-ref-name in my web.xml must
> match an ejb-ref-name in the jboss-web.xml file.
> 5) Perhaps my code must match a ejb-ref-name in here
> instead of in the jboss-web.xml file?
> My ejb-jar.xml:
No. The jndi-name of the ejb-ref in jbossweb.xml maps
to the jndi-name you used to deploy the ejb specified in
ejb-link work in the same deployment this maps to
> 6) Easy one. The home and remote in the ejb-jar.xml
> must match the home and remote in the web.xml,
> My jboss.xml:
Yes, but jboss doesn't use it. I think it will still work
if you get it wrong on the ref-name.
> 7) Easy one. The ejb-name in jboss.xml must match the
> ejb-name in ejb-jar.xml, right?
> 8) What does the jndi-name in the jboss.xml have to
> match? I'm guessing it's the jndi-name in
> jboss-web.xml, right?
It is the definition, it is not a ref-name.
Keep it shorter next time.