2 Replies Latest reply on Mar 24, 2004 11:28 PM by kondetisree

    Pls. suggest me which way is better to find MBeans using wit

    kondetisree

      Hi ..
      Here we in the process of finding the MBeans by using two ways... So could you suggest me which is the better way.


      1) Using with "ejb/mgmt/MEJB" lookup and ManagementHome

      Here we need to place the ejb-management.jar into server/default/deploy folder to find out
      Sample code :

      Properties env = new Properties();
      Hashtable ht = new Hashtable();
      env.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      env.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
      env.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");

      InitialContext ctx = new InitialContext(env);


      Object objpl = null;
      NamingContext nc = null;
      NamingEnumeration ne = null;

      objpl= ctx.lookup("ejb/mgmt/MEJB");


      ManagementHome home =
      (ManagementHome)PortableRemoteObject.narrow(objref,
      ManagementHome.class);
      Management mejb = home.create();

      String domain = mejb.getDefaultDomain();
      Set names = mejb.queryNames(new ObjectName(domain +":j2eeType=J2EEServer,*"), null);

      Iterator itr = names.iterator();
      while(itr.hasNext()) {
      ObjectName name = (ObjectName)itr.next();
      System.out.println("EJBModule: " + name);
      //ObjectName ejbs = (ObjectName)
      String temp =(String)mejb.getAttribute(name, "ServerVersion");
      System.out.println("ServerVendor "+temp);


      ==============

      2) Using with RMIAdaptor


      Sample Code:

      objpl = ctx.lookup("jmx/invoker/RMIAdaptor");
      RMIAdaptor rad = (RMIAdaptor)PortableRemoteObject.narrow(objpl,RMIAdaptor.class);
      String domain = rad.getDefaultDomain();

      Set names = rad.queryNames(new ObjectName("jboss.system:type=ServerInfo"),null);
      System.out.println("QuerryNames: " + names);
      Iterator itr = names.iterator();
      ObjectName name = (ObjectName)itr.next();
      String temp = (String)rad.getAttribute(name,"HostAddress");
      System.out.println("AttributeValue "+temp);

      ============


      If we use ManagementHome we have to copy that ejb-management.jar into deploy folder specifically know. So pls. suggest me which is the better way to follow up.


      Thanks & Regards,
      Srikanth Kondeti

        • 1. Re: Pls. suggest me which way is better to find MBeans using
          starksm64

          Which is best is up to you.

          The MEJB interface is defined by the JSR-77 spec and has a well defined role based security model. It requires additional setup and client code.

          The RMIAdaptor is a JBoss specific adaptor that is our default interface so its simple to use. As of 3.2.4RC1 is support authenticated users, but not role based permissions.

          • 2. Re:Is RMIAdaptor support further version of Jboss
            kondetisree

            Hi Scott..

            Thanks for ur valueble replies.

            As u mentioned that decison is up to me whether I will to for ManagementHome with MEJB stuff or with RMIAdaptor.

            Is that RMIAdaptor concept will be support for Jboss further versions also??

            Is there any way to proceed with MEJB concept without copying ejb-management.jar into deploy folder ..

            Becoz we can't manually copy that jar in client machines where Jboss running..

            So please give the brief clarification.... We are trying to find based on JMX that Jboss server is running and these are the configurations.


            Regards,
            Srikanth Kondeti