3 Replies Latest reply on Jan 3, 2004 2:39 PM by thezman

    Lookup of jmx/rmi/RMIAdaptor fails in 3.2.3

    gwwallace

      In the startService method of my MBean I do

      InitialContext ctx = new InitialContext();
      RMIAdaptor adaptor = (RMIAdaptor) ctx.lookup("jmx/rmi/RMIAdaptor");

      It works in 3.2.2 but fails with a NameException (jmx not found) in 3.2.3

        • 1. Re: Lookup of jmx/rmi/RMIAdaptor fails in 3.2.3

          It does show up ok on my JNDIView:

          Global JNDI Namespace

          +- jmx (class: org.jnp.interfaces.NamingContext)
          | +- invoker (class: org.jnp.interfaces.NamingContext)
          | | +- RMIAdaptor (proxy: $Proxy22 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor)
          | +- rmi (class: org.jnp.interfaces.NamingContext)
          | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)

          Does it show up on yours?

          • 2. Re: Lookup of jmx/rmi/RMIAdaptor fails in 3.2.3
            gwwallace

            Yes i can see it in JNDIView, just cant access it from code.

            • 3. Re: Lookup of jmx/rmi/RMIAdaptor fails in 3.2.3
              thezman

              Do you still have this problem?

              I think you are missing the step to narrowing the context to the right object. Usually in naming service, you obtain a root context object like this:

              import javax.naming.Context;
              import javax.naming.InitialContext;
              import javax.rmi.PortableRemoteObject;
              
              InitialContext ctx = new InitialContext(env);
              Object ref = ctx.lookup("jmx/invoker/RMIAdaptor");
              


              And then you need to narrow it to the right object like this:
              RMIAdaptor rmiAdapter =(RMIAdaptor)PortableRemoteObject.narrow(ref, RMIAdaptor.class);
              


              cheers