1 Reply Latest reply on Apr 27, 2007 9:18 AM by Wolfgang Knauf

    EJB problem

    shiva prasad Newbie

      hi
      I am new to EJBs. I am developing a J2EE application using NetBeans IDE. My project is deployed successfully, but when I try to run the servlet from the webmodule to retrieve data from the database, I get the error "javax.naming.NamingException: ejb-ref: ejb/CustomerFacadeBean, no ejb-link in web.xml and no jndi-name in jboss-web.xml"

      and the output is "No such Entity!"
      These are my web.xml and jboss-web.xml files

      web.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

      <servlet-name>Movies</servlet-name>
      <servlet-class>edu.umassd.ecom.Movies</servlet-class>


      <servlet-name>Dates</servlet-name>
      <servlet-class>edu.umassd.ecom.Dates</servlet-class>


      <servlet-name>Times</servlet-name>
      <servlet-class>edu.umassd.ecom.Times</servlet-class>


      <servlet-name>Availability</servlet-name>
      <servlet-class>edu.umassd.ecom.Availability</servlet-class>


      <servlet-name>Confirmation</servlet-name>
      <servlet-class>edu.umassd.ecom.Confirmation</servlet-class>


      <servlet-name>Cancellation</servlet-name>
      <servlet-class>edu.umassd.ecom.Cancellation</servlet-class>

      <servlet-mapping>
      <servlet-name>Movies</servlet-name>
      <url-pattern>/Movies</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>Dates</servlet-name>
      <url-pattern>/Dates</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>Times</servlet-name>
      <url-pattern>/Times</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>Availability</servlet-name>
      <url-pattern>/Availability</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>Confirmation</servlet-name>
      <url-pattern>/Confirmation</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>Cancellation</servlet-name>
      <url-pattern>/Cancellation</url-pattern>
      </servlet-mapping>
      <session-config>
      <session-timeout>
      30
      </session-timeout>
      </session-config>
      <welcome-file-list>
      <welcome-file>
      index.jsp
      </welcome-file>
      </welcome-file-list>
      <ejb-ref>
      <ejb-ref-name>ejb/MovielistFacadeBean</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      edu.umassd.ecom.MovielistFacadeRemoteHome
      edu.umassd.ecom.MovielistFacadeRemote
      <ejb-link>MovieTicketReservation-EJBModule.jar#MovielistFacadeBean</ejb-link>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ejb/MovieinfoFacadeBean</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      edu.umassd.ecom.MovieinfoFacadeRemoteHome
      edu.umassd.ecom.MovieinfoFacadeRemote
      <ejb-link>MovieTicketReservation-EJBModule.jar#MovieinfoFacadeBean</ejb-link>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ejb/MovieinfoFacadeBean1</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      edu.umassd.ecom.MovieinfoFacadeRemoteHome
      edu.umassd.ecom.MovieinfoFacadeRemote
      <ejb-link>MovieTicketReservation-EJBModule.jar#MovieinfoFacadeBean</ejb-link>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ejb/MovieinfoFacadeBean2</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      edu.umassd.ecom.MovieinfoFacadeRemoteHome
      edu.umassd.ecom.MovieinfoFacadeRemote
      <ejb-link>MovieTicketReservation-EJBModule.jar#MovieinfoFacadeBean</ejb-link>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ejb/CustomerFacadeBean</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      edu.umassd.ecom.CustomerFacadeRemoteHome
      edu.umassd.ecom.CustomerFacadeRemote
      <ejb-link>MovieTicketReservation-EJBModule.jar#CustomerFacadeBean</ejb-link>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ejb/CustomerFacadeBean1</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      edu.umassd.ecom.CustomerFacadeRemoteHome
      edu.umassd.ecom.CustomerFacadeRemote
      <ejb-link>MovieTicketReservation-EJBModule.jar#CustomerFacadeBean</ejb-link>
      </ejb-ref>
      </web-app>

      jboss-web.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-web>
      <security-domain flushOnSessionInvalidation="false"/>
      <context-root>/MovieTicketReservation-WebModule</context-root>
      </jboss-web>

      Please help me with this.

        • 1. Re: EJB problem
          Wolfgang Knauf Master

          Hi !

          I think you have to declare the ENC entries in jboss-web.xml, too. At least I did not manage it with ejb links.
          web-xml should just

          Your jboss-web.xml should contain this:

          <ejb-ref>
           <ejb-ref-name>ejb/MovielistFacadeBean</ejb-ref-name>
           <ejb-ref-type>Session</ejb-ref-type>
           <home>java.lang.Object</home>
           <remote>...</remote>
           </ejb-ref>



          <ejb-ref>
           <ejb-ref-name>ejb/MovielistFacadeBean</ejb-ref-name>
           <jndi-name>EARName/MovielistFacadeBean/remote</jndi-name>
           </ejb-ref>


          Hope this helps

          Wolfgang