<ejb-local-ref> question
dsconnelly May 26, 2002 5:31 PM(I am using JBoss 3.0 RC3)
Can I map a JNDI ENC reference to an <ejb-local-ref> in the jboss.xml using <ejb-ref>??
I want to get the Local Interface lookup to work the same on Sun J2EE-RI as on JBoss.
But Sun's J2EE-RI doesn't allow a <local-jndi-name> for the Local Interface.
For Sun, it appears that the container sets up a JNDI ENC mapping direct to the Local Interface, based on the er.xml descriptor. No other naming needed, or wanted. So a JNDI ENC lookup works in Sun J2EE-RI to get a Local Interface.
This works on Sun because Local Interfaces are defined only between EJBs in the same naming context.
Not so in JBoss. JBoss seems to want to lookup on the <local-jndi-name>, which is a (global) JNDI name.
One way (I thought) to bridge the gap (and to get portability) would be to put a reference-to-JNDI mapping into the jboss.xml descriptor for the referring EJBs naming context. Then I would do the lookup Sun's way, using the JNDI ENC.
However, this just gives me a deployment error on JBoss.
ejb-ref ejb/WorkTaskLocal found in jboss.xml but not in ejb-jar.xml
But, taken literally, this is FALSE. The reference name is in both ejb-jar.xml and in jboss.xml. Sort of. I want to map the reference name to a <local-jndi-name>, but the markup implies that I should be giving a <jndi-name>. I suppose JNDI names and Local JNDI names cannot work exactly the same way. The JNP cannot be serving up Local Interfaces, for instance.
If there is another syntax for mapping a reference name to a Local Interface JNDI name. If so, XDoclet does not seem to be aware of it.
But there is somewhat coincidently (??) an XDoclet bug in XDoclet's @jboss:ejb-ref-jndi markup system. I use this to generate the jboss.xml. Due to this bug, I get "ejb/ejb/WorkTaskLocal" as the ref-name in the jboss.xml. But this is minor and easy to hack around. Or so I thought. I have not found any formulation of the ref-name that allows JBoss to deploy a mapping to a local JNDI name for that ref name.
ebj-jar.xml ----------------------------------------
<ejb-local-ref >
<ejb-ref-name>ejb/WorkTaskLocal</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>com.mycorp.wf.interfaces.WorkTaskLocalHome</local-home>
com.mycorp.wf.interfaces.WorkTaskLocal
<ejb-link>WorkTask</ejb-link>
</ejb-local-ref>
jboss.xml ------------------------------------------
<ejb-name>WorkTask</ejb-name>
<jndi-name>WORKTASK</jndi-name>
<local-jndi-name>WORKTASKLOCAL</local-jndi-name>
<ejb-name>WorkTicket</ejb-name>
<jndi-name>WORKTICKET</jndi-name>
<local-jndi-name>WORKTICKETLOCAL</local-jndi-name>
<ejb-ref>
<ejb-ref-name>ejb/WorkTaskLocal</ejb-ref-name>
<jndi-name>WORKTASKLOCAL</jndi-name>
</ejb-ref>