1 Reply Latest reply on Feb 23, 2002 9:46 AM by jk.mkiii

    <ejb-ref> problem

    jk.mkiii

      I posted about this to mailing list but tought it would be nice idea to post here too so more people could try to point my error.

      I have my application packed in ear and inside that I have jar that contains my security beans. Part of my ejb-jar.xml


      <ejb-name>Shepherd/security/Login</ejb-name>
      fi.hut.cs.NC.Shepherd.security.LoginHome
      fi.hut.cs.NC.Shepherd.security.Login
      <ejb-class>fi.hut.cs.NC.Shepherd.ejb.security.LoginBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-ref>
      CredentialManager bean
      <ejb-ref-name>ejb/CredentialManager</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      fi.hut.cs.NC.Shepherd.security.CredentialManagerHome
      fi.hut.cs.NC.Shepherd.security.CredentialManager
      <ejb-link>Shepherd/security/CredentialManager</ejb-link>
      </ejb-ref>


      So I should be able to use in my bean code "ejb/CredentialManager" or "java:comp/env/ejb/CredentialManager" to locate bean that is connected to "Shepherd/security/CredentialManager" name? That is how I have understood all examples, but when I call method in Login bean that tries to get CredentialManager server throws exception saying "ejb not bound".


      According to JNDIView java:comp/env/ejb in Login bean is linked to Shepherd/security/CredentialManager

      java:comp namespace of the Shepherd/security/Login bean:
      +- env (class: org.jnp.interfaces.NamingContext)
      | +- ejb (class: org.jnp.interfaces.NamingContext)
      | | +- CredentialManager[link -> Shepherd/security/CredentialManager] (class: javax.naming.LinkRef)
      | | +- PrincipalManager[link -> Shepherd/security/PrincipalManager] (class: javax.naming.LinkRef)
      | | +- AccountManager[link -> Shepherd/security/AccountManager] (class: javax.naming.LinkRef)


      But still get RemoteException saying "ejb not bound when I try to lookup bean using ejb/CredentialManager". :( I know my system works happily if use full names in beans (in code lookup for "Shepherd/security/CredentialManager") but that doesn't seem as right way to do things.

      If it matters I am using jboss 2.4.0 on Windows 2000 with Sun's 1.3.1 jdk.

      --
      jK.MkIII

        • 1. Re: <ejb-ref> problem
          jk.mkiii

          Found what was wrong. Many thanks to Alex who on mailing list tried to locate error with me in deployment descriptors.

          Descriptors were correct, but error was that I had EJB class that all my beans extended and had basic functions like looking up objects in helper functions and when got InitialContext in this superclass it didn't get right context. When changed it so that InitialContext is created in actual bean class and moved helper functions to helper class that I create in bean class it started working.

          So even it was still bean asking for InitialContext it didn't get right one because code was not in bean class, but in superclass. Anyone know if this is feature or bug?

          --
          jK.MkIII