(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.
Sorry. The question was worded badly. I meant to ask:
Can I map a JNDI ENC <ejb-local-ref> to a <local-jndi-name> in the jboss.xml using an <ejb-ref> declaration??
I face such problem also.
And I change all the <ejb-local-ref> to <ejb-ref> but it seems such modification could just cover the error of deploying. I deploy my project successfully but it could not be run. It seems jboss server just find them with the <ejb-link> in the ejb-jar.xml
I see my problem now.
The jboss.xml is not involved. The local-jndi-name is not involved. Everything that's needed goes into the ejb-jar.xml.
If the <ejb-link> is generated correctly in the <ejb-local-ref> in ejb-jar.xml, then everything works fine.
As you can see, I had the <ejb-link> OK. I just had to quit fooling around with the jboss.xml, looking for a local-jndi-name hook. It seems that there might be one. There isn't.
In XDoclet terms, just make sure you use the @ejb:ejb-ref and give all three attributes.
I just spent the entire morning with this problem.
> The jboss.xml is not involved.
The problem is that if you pair a corresponding "@jboss:ejb-ref-jndi" tag with the "@ejb:ejb-ref" tag (which I thought you were supposed to) it becomes involved. The "@jboss:ejb-ref-jndi" tag leads to an "ejb-ref" entry in jboss.xml which, upon deployment, generates an error (which I've included at the end of this message).
Now I admit I'm new to EJB's and JBoss, so maybe I misused "@jboss:ejb-ref-jndi", but my stuff didn't work with it and now works without it. If I'm suffering from some misunderstanding, I'd love to have someone clear it up for me.
14:46:52,672 ERROR [MainDeployer] could not create deployment:file:/C:/Bin/Web/Server/jboss3.0.0/server/default/deploy/Application.ear
org.jboss.deployment.DeploymentException: Error in jboss.xml for Bean Register: ejb-ref ejb/PhoneNumber found in jboss.xml but not in ejb-jar.xml
at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
at $Proxy4.deploy(Unknown Source)