1 Reply Latest reply on Sep 15, 2004 4:52 PM by darranl

    Problem in accessing local home interface

    imsathya

      Hi,

      I am facing a curious problem ! When I try to access an entity bean from a session facade locally using the component name of the bean, I get a ejb not bound error. This does not happen if I specify the JNDI name !

      From jboss.xml :

       <entity>
       <ejb-name>Journal</ejb-name>
       <jndi-name>ejb/JournalHome</jndi-name>
       <local-jndi-name>ejb/JournalLocalHome</local-jndi-name>
      
       <method-attributes>
       </method-attributes>
      
       </entity>
      


      Now when I try to use the component name :

      InitialContext ic = new InitialContext();
      
      JournalLocalHome home = (JournalLocalHome) ic.lookup("java:comp/env/ejb/JournalLocalHome");
      


      I get the below error :

      javax.naming.NameNotFoundException: ejb not bound
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
       at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:256)
      


      But when I do the lookup with the JNDI name :

      InitialContext ic = new InitialContext();
      
      JournalLocalHome home = (JournalLocalHome) ic.lookup("ejb/JournalLocalHome");


      it works just fine !

      Any configuration I need to do to make the bean accessible by component name ?

      Thanks.

        • 1. Re: Problem in accessing local home interface
          darranl

          To make another bean visible under the java:comp/env namespace of the bean making the lookup call you need to add a <ejb-local-ref> element to the definition of the bean performing the lookup in the ejb-jar.xml.

          The details of this are documented in the dtd.

          You can use JNDI View from JMX Console to check the java:comp/env namespace of your individual components.