3 Replies Latest reply on Nov 26, 2003 7:21 PM by jonlee

    strange behaviour in <ejb-local-ref>

    pangj

      I have an ejb-jar.xml file which works on Borland Enterprise Server, but falls over on JBoss.

      In my assembly descriptor, I have a session bean which uses <ejb-local-ref> elements to reference another local EJB.

      <ejb-local-ref>
      <ejb-ref-name>ejb/VATAddress</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.axxia.pkc.axfile.afcl.session.setup.VATAddressHomeLocal</local-home>
      com.axxia.pkc.axfile.afcl.session.setup.VATAddressLocal
      </ejb-local-ref>

      However, in the JNDI view from the JMX console, the JNDI entry appears as null. For some reason, JBoss is not putting my local ref into JNDI. There are lots of other local refs defined in my ejb-jar.xml file and they all appear fine in the JNDI view. The only difference with my "VATAddress" EJB from my other EJBs is that it defines both local and remote interfaces. The funny thing is, if I use the names of the remote home and remote interface in the <local-home> and elements instead, it all works! (But it shouldn't do!!?)

      Any help will be much appreciated.

        • 1. Re: strange behaviour in <ejb-local-ref>
          jonlee

          Did you define a jboss.xml with the following?

          <enterprise-beans>
           <session>
           <ejb-name>ejb/VATAddress</ejb-name>
           <jndi-name>ejb/remote/VATAddress</jndi-name>
           <local-jndi-name>ejb/local/VATAddress</local-jndi-name>

          There are two bindings - one for each home. Perhaps look at http://www.amitysolutions.com.au/documents/JBossJNDI-technote.pdf. It gives a rough description of the mapping JBoss uses.

          • 2. Re: strange behaviour in <ejb-local-ref>
            pangj

            Thanks for the reply jonlee,

            I have defined <jndi-name> and <local-jndi-name> elements in jboss.xml, but with naming convention different to yours. But naming convention shouldn't be a problem, should it? Hmm...

            <enterprise-beans>

            <ejb-name>ejb/VATAddress</ejb-name>
            <jndi-name>ejb/VATAddress</jndi-name>
            <local-jndi-name>ejb/VATAddressLocal</local-jndi-name>

            • 3. Re: strange behaviour in <ejb-local-ref>
              jonlee

              Naming convention shouldn't be an issue. But you are binding two different things. If you want both local and remote bindings, you need to declare the remote and local interfaces in ejb-jar as well.

              In the jboss.xml mapping:
              One JNDI entry is for the local interfaces - JBoss works this out.
              The other JNDI entry is for the remote interfaces.
              e.g.

              +- ejb (class: org.jnp.interfaces.NamingContext)
               | +- amity (class: org.jnp.interfaces.NamingContext)
               | | +- general (class: org.jnp.interfaces.NamingContext)
               | | | +- local (class: org.jnp.interfaces.NamingContext)
               | | | | +- ListManager (proxy: $Proxy107 implements interface com.amity.general.listmanager.ListManagerLocalHome)
               | | | +- remote (class: org.jnp.interfaces.NamingContext)
               | | | | +- ListManager (proxy: $Proxy109 implements interface com.amity.general.listmanager.ListManagerHome,interface javax.ejb.Handle)