1 Reply Latest reply on Apr 6, 2005 7:15 AM by Christian Arbeiter

    Access MBeans in clustered environment

    Christian Arbeiter Newbie

      I'm running in JBOSS 4.0.1 in a clustered environment. At the moment both cluster-instances run on the same machine.
      I registered a mbean in both cluster instances and can see them in the jmx-console. The name of the mbean consists of the mbean-name and the cluster node.


      These mbeans are responsible for holding configurations for applications.

      I try to access both mbeans from an application inside the cluster. The problem is that the queryMBeans-Method always replies the node1 mbean (see code below).

      Can anyone help, what is wrong? Maybe there is also a better way to treat with this problem.

      Properties cluster1 = new Properties();
      cluster1.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      cluster1.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      cluster1.put(Context.PROVIDER_URL, "jnp://myServer:19201");
      InitialContext ctx = new InitialContext(cluster1);
      RMIAdaptor mbean = (RMIAdaptor) ctx.lookup("jmx/rmi/RMIAdaptor");
      ObjectName name = new ObjectName(objectName); //???:type=CommonServiceMBean,name=ConfigurationService,*
      Properties cluster2 = new Properties();
      cluster2.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      cluster2.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      cluster2.put(Context.PROVIDER_URL, "jnp://myServer:19301");
      InitialContext ctx1 = new InitialContext(cluster2);
      RMIAdaptor mbean2 = (RMIAdaptor) ctx1.lookup("jmx/rmi/RMIAdaptor");