0 Replies Latest reply on Jul 31, 2006 12:34 PM by Smith Aron

    I have remote working - but need a reference to a local bean

    Smith Aron Newbie

      Accessing beans through the remote interface is working well. Within the container I want to have a bean access another bean - I think via the local interface (but I'll take what I can get). However i get a null reference back - any ideas what I am doing wrong?


      private static IMyoneLocal getMyone() throws ClassCastException, NamingException {
      return (IMyoneLocal) PortableRemoteObject.narrow(
      getBean(), IMyoneRemote.class);
      }

      private static Object getBean() throws NamingException {
      if (ctx == null) {
      ctx = new InitialContext();
      }
      String beanName = "MyoneBean/local";
      Object ref = ctx.lookup(beanName);
      return ref;
      }

      Is there anything special I need to meet the requirements of the context - seems unlikely given that I am in the container?

      thanks