2 Replies Latest reply on Apr 20, 2004 11:40 AM by Raja

    JNDI Context lookup failure with jboss 3.2.3

    benwang Newbie

      Dear all,

      Recently I tried to convert my program from websphere 5.1 to jboss 3.2.3, but I encountered jndi binding problem in the following statement :

      Object homeObject = ctx.lookup("java:comp/env/ega/Login");
      LoginHome loginHome = (LoginHome) javax.rmi.PortableRemoteObject.narrow(homeObject,LoginHome.class );
      Login login = loginHome.create();

      It always give me an error as follows :
      10:15:37,516 INFO [STDOUT] NamingExceptionCould not dereference object
      10:15:37,516 ERROR [STDERR] javax.naming.NamingException: Could not dereference
      object. Root exception is
      10:15:37,516 ERROR [STDERR] javax.naming.NameNotFoundException: ega not bound


      Is there anybody kindly help me up , following is my web.xml, jboss-web.xml & jboss.xml for your reference :

      1. web.xml
      <?xml version = '1.0' encoding = 'UTF-8'?>
      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
      <web-app>
      <display-name>HelpDesk War</display-name>
      HelpDesk BMP war

      <servlet-name>HelpDeskServlet</servlet-name>
      <display-name>HelpDesk Servlet</display-name>
      HelpDesk Servlet
      <servlet-class>com.ega.hd.HelpDeskWAR.HelpDeskServlet</servlet-class>


      <servlet-name>UploadAttachment</servlet-name>
      <display-name>UploadAttachment</display-name>
      Upload Attachment
      <servlet-class>com.ega.hd.HelpDeskWAR.UploadAttachment</servlet-class>


      <servlet-name>helpdesk</servlet-name>
      <servlet-class>com.ega.hd.HelpDeskWAR.helpdesk</servlet-class>


      <servlet-name>Servlet1</servlet-name>
      <servlet-class>com.ega.pj.ProjectWAR.Servlet1</servlet-class>


      <servlet-name>ProjectWeb</servlet-name>
      <servlet-class>com.ega.pj.ProjectWAR.ProjectWeb</servlet-class>

      <servlet-mapping>
      <servlet-name>HelpDeskServlet</servlet-name>
      <url-pattern>/HelpDesk/HelpDeskServlet</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>UploadAttachment</servlet-name>
      <url-pattern>/HelpDesk/UploadAttachment</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>helpdesk</servlet-name>
      <url-pattern>/helpdesk</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>ProjectWeb</servlet-name>
      <url-pattern>/projectweb</url-pattern>
      </servlet-mapping>
      <welcome-file-list>
      <welcome-file>LoginJSP.jsp</welcome-file>
      </welcome-file-list>
      <resource-ref>
      <res-ref-name>jdbc/egauhd</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Application</res-auth>
      </resource-ref>
      <ejb-ref>
      <ejb-ref-name>ega/ActionList</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.ActionListHome
      com.ega.hd.HelpDeskEJB.ActionList
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/CPUStaffList</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.CPUStaffListHome
      com.ega.hd.HelpDeskEJB.CPUStaffList
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/CategoryList</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.CategoryListHome
      com.ega.hd.HelpDeskEJB.CategoryList
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/ClientList</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.ClientListHome
      com.ega.hd.HelpDeskEJB.ClientList
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/Login</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.LoginHome
      com.ega.hd.HelpDeskEJB.Login
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/Logoff</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.LogoffHome
      com.ega.hd.HelpDeskEJB.Logoff
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/Mailer</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.MailerHome
      com.ega.hd.HelpDeskEJB.Mailer
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/SystemPICList</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.SystemPICListHome
      com.ega.hd.HelpDeskEJB.SystemPICList
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/TicketDetail</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.TicketDetailHome
      com.ega.hd.HelpDeskEJB.TicketDetail
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/TicketList</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.TicketListHome
      com.ega.hd.HelpDeskEJB.TicketList
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/TicketUpdate</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.TicketUpdateHome
      com.ega.hd.HelpDeskEJB.TicketUpdate
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/VendorList</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.ega.hd.HelpDeskEJB.VendorListHome
      com.ega.hd.HelpDeskEJB.VendorList
      </ejb-ref>
      </web-app>

      2. jboss-web.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_0.dtd">
      <jboss-web>
      <resource-ref>
      <res-ref-name>jdbc/egauhd</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <jndi-name>java:/egauhd</jndi-name>
      </resource-ref>

      <ejb-ref>
      <ejb-ref-name>ega/ActionList</ejb-ref-name>
      <jndi-name>ega/ActionList</jndi-name>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/CPUStaffList</ejb-ref-name>
      <jndi-name>ega/CPUStaffList</jndi-name>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/CategoryList</ejb-ref-name>
      <jndi-name>ega/CategoryList</jndi-name>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/ClientList</ejb-ref-name>
      <jndi-name>ega/ClientList</jndi-name>
      </ejb-ref>


      <ejb-ref>
      <ejb-ref-name>ega/Login</ejb-ref-name>
      <jndi-name>ega/Login</jndi-name>
      </ejb-ref>
      <ejb-ref >
      <ejb-ref-name>ega/Logoff</ejb-ref-name>
      <jndi-name>ega/Logoff</jndi-name>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/Mailer</ejb-ref-name>
      <jndi-name>ega/Mailer</jndi-name>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/SystemPICList</ejb-ref-name>
      <jndi-name>ega/SystemPICList</jndi-name>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/TicketDetail</ejb-ref-name>
      <jndi-name>ega/TicketDetail</jndi-name>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/TicketList</ejb-ref-name>
      <jndi-name>ega/TicketList</jndi-name>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/TicketUpdate</ejb-ref-name>
      <jndi-name>ega/TicketUpdate</jndi-name>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ega/VendorList</ejb-ref-name>
      <jndi-name>ega/VendorList</jndi-name>
      </ejb-ref>
      </jboss-web>

      3. jboss.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">


      <enterprise-beans>

      <ejb-name>ActionList</ejb-name>
      <jndi-name>ega/ActionList</jndi-name>


      <ejb-name>CPUStaffList</ejb-name>
      <jndi-name>ega/CPUStaffList</jndi-name>


      <ejb-name>CategoryList</ejb-name>
      <jndi-name>ega/CategoryList</jndi-name>


      <ejb-name>ClientList</ejb-name>
      <jndi-name>ega/ClientList</jndi-name>


      <ejb-name>Login</ejb-name>
      <jndi-name>ega/Login</jndi-name>


      <ejb-name>Logoff</ejb-name>
      <jndi-name>ega/Logoff</jndi-name>


      <ejb-name>Mailer</ejb-name>
      <jndi-name>ega/Mailer</jndi-name>


      <ejb-name>SystemPICList</ejb-name>
      <jndi-name>ega/SystemPICList</jndi-name>


      <ejb-name>TicketDetail</ejb-name>
      <jndi-name>ega/TicketDetail</jndi-name>


      <ejb-name>TicketList</ejb-name>
      <jndi-name>ega/TicketList</jndi-name>


      <ejb-name>TicketUpdate</ejb-name>
      <jndi-name>ega/TicketUpdate</jndi-name>


      <ejb-name>VendorList</ejb-name>
      <jndi-name>ega/VendorList</jndi-name>

      </enterprise-beans>
      <resource-managers>
      </resource-managers>


      Thanks.




        • 1. Re: JNDI Context lookup failure with jboss 3.2.3
          Tilo Thiele Newbie

          I can't see any env-entry tags in your web.xml but only ejb-refs.
          So, I suppose you should write
          Object homeObject = ctx.lookup("java:comp/ejb/ega/Login");
          instead of
          Object homeObject = ctx.lookup("java:comp/env/ega/Login");

          • 2. Re: JNDI Context lookup failure with jboss 3.2.3
            Raja Master

            <ejb-ref>
            <ejb-ref-name>ega/Login</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            com.ega.hd.HelpDeskEJB.LoginHome
            com.ega.hd.HelpDeskEJB.Login
            </ejb-ref>

            Shouldnt the above be something like
            <ejb-ref>
            <ejb-ref-name>ega/Login</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            com.ega.hd.HelpDeskEJB.LoginHome
            com.ega.hd.HelpDeskEJB.Login
            </ejb-ref>

            I added the home and remote tags. Is this how it is in ur ejb-jar.xml, Im not sure how it wud have deployed given the way you specified in the original post!
            Can yu change it like this(if its not already) and try , deploy and run