8 Replies Latest reply on Jun 26, 2003 10:39 AM by adrian.brock

    Global JNDI

    sraj

      Hi

      I have a session bean for which i have defined the jndi-name in jboss.xml as

      <jndi-name>com/comp/app/MySessionBean</jndi-name>

      But when I lookup the JNDIView i find it mapped simply as MySessionBean in Global JNDI Namespace. Would like to know why its not getting mapped as com.comp.app.MySessionBean.

      Thanks

        • 1. Re: Global JNDI

          You have the tag in the wrong place in jboss.xml

          <enterprise-beans>
          MySessionBean
          <jndi-name>whatever</jndi-name>

          Regards,
          Adrian

          • 2. Re: Global JNDI

            Completely wrong. :-)

            <enterprise-beans>

            <ejb-name>MySessionBean</ejb-name>
            <jndi-name>whatever</jndi-name>


            Regards,
            Adrian

            • 3. Re: Global JNDI
              sraj

              yes, thats how it is setup in my jboss.xml but it wont recognize the initial part of the name.

              • 4. Re: Global JNDI

                Can you post the full deployment descriptors,
                it is likely you have something in the wrong place.

                Regards,
                Adrian

                • 5. Re: Global JNDI
                  sraj

                  <?xml version="1.0" encoding="UTF-8"?>



                  <enterprise-bean>

                  <ejb-name>MySessionEJB</ejb-name>

                  <resource-ref>
                  <res-ref-name>jdbc/dbPool</res-ref-name>
                  <jndi-name>dbPool.DS</jndi-name>
                  </resource-ref>

                  <jndi-name>com/comp/app/ejb/MySessionEJB</jndi-name>

                  </enterprise-bean>

                  <enterprise-bean>

                  <ejb-name>MyCMPEJB</ejb-name>

                  <local-jndi-name>com/comp/app/ejb/MyCMPEJB</local-jndi-name>

                  </enterprise-bean>



                  And the JNDIView gives ...
                  Global JNDI Namespace
                  +- MySessionEJB (proxy: $Proxy32 implements interface com.comp.app.ejb.interfaces.MySessionHome,interface javax.ejb.Handle)

                  I suppose it should be
                  +-com
                  +-comp
                  +-app
                  +-ejb
                  +-MySessionEJB

                  so that from my jsp i can look it up as ...
                  com.comp.app.ejb.MySessionEJB instead of just MySessionEJB

                  Thanks
                  Shabs

                  • 6. Re: Global JNDI

                    <enterprise-beans>

                    Regards,
                    Adrian

                    • 7. Re: Global JNDI
                      sraj

                      thanks

                      btw, if i have my jndi name as com/comp/app/MySessionBean i have to look it up in my jsp as com/comp/app/MySessionBean and not com.comp.app.MySessionBean

                      to look it up as com.comp.app.MySessionBean i need to define it as com.comp.app.MySessionBean.

                      question is, whats the difference and which is the prefered way .. since both seems to work.

                      • 8. Re: Global JNDI

                        The spec recommended name is to bind it at
                        ejbs/app/MySessionBean
                        but it is only a convention.

                        For jsp access, the spec recommendeds
                        creating an ejb-ref in your web.xml
                        then use
                        java:/comp/env/{ejb-ref-name}
                        ejb-ref is normally something like ejbs/SomeAlias

                        Have a look at some examples on the web.

                        Regards,
                        Adrian