4 Replies Latest reply on Sep 6, 2002 4:23 PM by Paul Morgan

    <ejb-local-ref> question

    Dan Connelly Newbie

      (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>



        • 1. Re: <ejb-local-ref> question
          Dan Connelly Newbie

          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??

          • 2. Re: <ejb-local-ref> question
            quitejack Newbie

            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

            • 3. Re: <ejb-local-ref> question
              Dan Connelly Newbie

              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.

              • 4. Re: <ejb-local-ref> question
                Paul Morgan Newbie

                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.

                Thanks,

                :Paul

                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 org.jboss.metadata.ApplicationMetaData.importJbossXml(ApplicationMetaData.java:544)
                at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:184)
                at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:326)
                at org.jboss.deployment.MainDeployer.create(MainDeployer.java:637)
                at org.jboss.deployment.MainDeployer.create(MainDeployer.java:631)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:512)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
                at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:324)
                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
                at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                at $Proxy4.deploy(Unknown Source)
                at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:405)
                at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:515)
                at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:202)
                at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)