4 Replies Latest reply on May 28, 2006 2:51 AM by Amit Bhayani

    referencing session bean from servlet.

    daniel jarrett Newbie

      In upgrading to 4.0.4.GA in the last day or so from 4.0.3SP1 if encountered a couple of issues in which i've had to refactor my code.
      I've sorted most of the problems out but now i'm left with one that baffles me.

      What I am trying to do is reference an ejb3 stateless session bean from within a servlet.
      I'm doing this with:

      InitialContext ctx = new InitialContext();
       MySession mySession = (MySession) ctx.lookup(MySession.class.getName());

      However I keep getting a namenotfoundexception. I have looked to see if the object is actually available within my packaging and it is.
      My packaging structure is below.

      ------>Session.class (my stateless session bean)
      ------>TestServlet.class (servlet that is referencing the session bean)

      Any ideas why this would happen?