4 Replies Latest reply on Nov 13, 2002 2:19 PM by Joe Flux

    Exception calling EJB from EJB

    Joe Flux Newbie

      Hi,

      I am trying to call a Session bean from an Entity bean as shown in the code:

      Context lContext = new InitialContext();
      Object homeObject = lContext.lookup("SequenceGenerator");

      SequenceGeneratorHome lHome = (SequenceGeneratorHome)
      PortableRemoteObject.narrow(homeObject,SequenceGeneratorHome.class);
      SequenceGenerator lBean = (SequenceGenerator) PortableRemoteObject.narrow(lHome.create(),SequenceGenerator.class);

      the above code throws a lookup failure NamingException
      I try the code below and with no difference:

      SequenceGeneratorHome lHome = (SequenceGeneratorHome) lContext.lookup("java:comp/env/ejb/testone/SequenceGenerator");
      SequenceGenerator lBean = (SequenceGenerator) lHome.create();

      Is there any different way of calling an EJB from with in an EJB??

      thanks.