I want to register my mbean with JNDI so that a client can retrieve the JNDIName and use the mbean. It works when I use the RMIAdapter instead, but I wanted to try the JNDI way.
I bound my mbean to JNDI as follows (jndiname is "inmemory/maps/MapTest2":
InitialContext rootCtx = new InitialContext(); Name fullName = rootCtx.getNameParser("").parse(jndiName); NonSerializableFactory.rebind(fullName, this, true);
Object obj = getContext().lookup ("inmemory/maps/MapTest2"); mytest.mbean.JNDIMap map = (mytest.mbean.JNDIMap)PortableRemoteObject.narrow(obj, mytest.mbean.JNDIMap.class);