7 Replies Latest reply on Mar 11, 2005 8:11 AM by burakbayramli

    Browsing Remote MBeans - Some Missing!

      Hi, I am writing an open source tool to watch and define alerts on MBeans and their attributes. For this, I need to be able to see all MBeans. I used to
      method below, and I am getting most of the MBeans, but not all. Especially the ones I registered using

      ObjectName name = new ObjectName("MyApp:type=MyStats");
      mbeanServer.registerMBean(stats, name);

      .. are nowhere to be seen.

      Any ideas? Thanks in advance.

      -------------

      private InitialContext getContext(String serverUrl)
      {
      Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      props.put(Context.URL_PKG_PREFIXES,
      "org.jboss.naming:org.jnp.interfaces");
      props.put(Context.PROVIDER_URL, serverUrl);
      InitialContext ic = new InitialContext(props);
      return ic;
      }


      public void connect(Machine machine) {
      try {
      this.machine = machine;
      InitialContext ic = getContext(machine.getId().getIp());
      server = (RMIAdaptor) ic.lookup("jmx/rmi/RMIAdaptor");
      } catch (Exception e) {
      throw new RuntimeException ("exception");
      }
      }

      public Map retrieveAllObjectNames() throws Exception {

      for (Object o : server.queryNames(new ObjectName("*:*"), null)) {
      String nameString = o.toString();
      ObjectName name = new ObjectName(nameString);

      try {
      MBeanInfo info = server.getMBeanInfo(name);
      Map values = new HashMap();
      for(MBeanAttributeInfo currInfo : info.getAttributes())
      {
      ...
      }
      ...
      }