There is something peculiar I found about JBoss's requirements for the EJB references. Please note that: no, I'm not packaging the ejb and client into a ear as I should do... I assume what I'm experiencing is in part 'cause of this... but this is for the sake of argument, and possibly tracking down a ?"bug"?
I've got two EJBs: one remote, and one local one. Each of them deploys just fine and is "advertised" in their respective jboss.xml under <jndi-name> and <local-jndi-name>.
I've got a test client for each of these beans (using Cactus) and here is where the funny stuff starts:
- for the remote bean and test client the web.xml ejb-reference works just fine without any sort of ejb-link gimmickry
- but for the local client the equivalent web.xml (substitute local for remote) makes JBoss spit out:
org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NamingException: ejb-local-ref: 'ejb/petstore/Order', no ejb-link in web.xml and no local-jndi-name in jboss-web.xml)
ejb references are only defined in the context of an ear or the same ejb jar.
A local ejb has no requirement to be accessible via jndi, and so in general its impossible for a war to even reference an external local ejb. Its purely an implementation detail in jboss that this works at all.