2 Replies Latest reply on May 17, 2002 3:15 AM by pra

    Why its null????

    tisomer

      hi,
      everyone,I create a Mbean,I want to access it through
      JNDI.But the object of result is null.
      Hashtable props = new Hashtable();
      props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      props.put(Context.PROVIDER_URL, "localhost:1099");
      props.put("java.naming.rmi.security.manager", "yes");
      props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
      Context context = new InitialContext(props);

      //InitialContext ctx = new InitialContext();
      HashMap map = (HashMap) context.lookup("inmemory/maps/MapTest");

      the "map" is null,
      who can you tell its why????

      thanks a lot

      tisom

        • 1. Re: Why its null????
          colinc

          Did you have any luck; I am having exactly the same issue with an mbean I have installed ? (castorjdoimpl)

          • 2. Re: Why its null????

            Because it has been gc-ed, i,e you are not holding any reference to to it. Having a class local (not static) variable in an MBean will not do, beacuse theses are gc:ed and made available dynalically through the MBean server (this is at least what I have experienced).

            //Peter