0 Replies Latest reply on Dec 6, 2001 7:16 AM by Oikonomopoulos Spyros

    Cant' create Session Bean from Entity Bean

    Oikonomopoulos Spyros Newbie


      I am using JBOss 2.4 and have succesfully deployed both my entity and session beans. Here is the problem:

      I have an entity bean that calls a (stateless) session bean. To obtain a reference to the session bean I call (in the setEntityContext of the entity bean):

      _availabilityHome = (AvailabilityHome) PortableRemoteObject.narrow(context.lookup("java:comp/env/ejb/Availability"), AvailabilityHome.class);

      And get a javax.naming.NameNotFoundException. The previous statement tries to acquire the home interface of an Entity bean, and works fine:

      ServiceTypeHome = (ServiceTypeHome) PortableRemoteObject.narrow(context.lookup("java:comp/env/ejb/ServiceType"), ServiceTypeHome.class);

      In addition, if I create the session bean from a client:

      Object ref = ctx.lookup("Availability");
      AvailabilityHome availabilityHome = (AvailabilityHome) PortableRemoteObject.narrow(ref, AvailabilityHome.class);

      It works fine too...

      Thanks in advance