A strict reading of the spec (although the wording is
not clear) requires you to use an <ejb-ref>
not an <ejb-local-ref> for access outside
the ear. That is how JBoss interprets it.
Also, because it is outside the ear, you cannot use an
<ejb-link> you must specify a <jndi-name> for the
<ejb-ref> in jboss-web.xml
Look at docs/dtd/jboss-web_3_0.dtd for more info.
Ok, adding an ejb-ref to the ejb of interest in web.xml and then pointing out the JNDI name of that ejb in jboss-web.xml does the trick.
To my surprise I noticed that my servlet in app1.ear could reference an ejb component in a module in app2.ear if I "JNDI look up" the last part of the complete JNDI name. Just use "ejb/component" instead of "java:comp/env/ejb/component". Is that behaviour something you may count on?
But it is not the recommended method.
In principle the war should reference
Then you can later change the dds to point at
without recompiling the web component.