0 Replies Latest reply on Jun 28, 2004 5:44 AM by snavjot

    best way to lookup beans

    snavjot Newbie

      hi,

      I am very confused about the beans lookup.

      I mean i have a set of beans that Jboss 3.2.3 deploys like this

      Started jboss.j2ee:jndiName=ejb/ProductManagerHome, service=EJB
      Started jboss.j2ee:jndiName=ejb/CartHome, service=EJB

      In jboss-web.xml,
      ejb/Cart maps to ejb/CartHome
      ejb/ProductManager maps to ejb/ProductManagerHome

      From servlet, i lookup Cart using "java:comp/env/ejb/Cart". SUCCESS.
      In my Cart bean, i lookup "java:comp/env/ejb/ProductManagerHome"

      the it throws ERROR

      javax.naming.NameNotFoundException: ProductManagerHome not bound

      WHY??

      Then i tried the following also. May be 3rd test is more relevant here.

      1. I tried to look up from the standalone client like this
      ic.lookup("ejb/ProductManagerHome"); and it got found. BUT if i printed the object found. it print "ejb/ProductManagerHomeHome" Why 1 extra Home??

      2. I tried to look up from the standalone client like this
      ic.lookup("java:comp/env/ejb/ProductManagerHome")

      it says **javax.naming.NameNotFoundException: comp not bound**

      3. I tried to look up from web client this
      ic.lookup("java:comp/env/ejb/ProductManager")

      It got found.

      What am i doing wrong?

      Navjot