0 Replies Latest reply on Aug 11, 2006 8:43 AM by vitalstrike82

    could not dereference object when running the EJB

      Hi,
      I'm using jboss4.0.3. I want to reference my jsp page to EJB but get a "could not dereference object" upon running the jsp with this as it went into the catch exception instead of looking up to the EJB:


      try {
      
       objref = initial.lookup("java:comp/env/ejb/MyMusicCart");
       System.out.println("lookup success for ejb/MyMusicCart");
       // a reference to the home interface is shareable
       cartHome = (MusicCartHome)PortableRemoteObject.narrow(objref, MusicCartHome.class);
       System.out.println("created MusicCartHome object");
      
       } catch (Exception ex) {
       System.out.println("Unexpected Exception: " +ex.getMessage());


      My web.xml
      <ejb-ref>
      <ejb-ref-name>ejb/MyMusicCart</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      asg.MusicCartEJB.MusicCartHome
      asg.MusicCartEJB.MusicCart
      <ejb-link>ejb-jar-ic.jar#MusicCartBean</ejb-link>
      
      </ejb-ref>
      


      Can anyone encounter this problem before? Please help