7 Replies Latest reply on Jul 20, 2004 7:53 AM by prese

    managing mBeans Programatically

    preeti123

      I want to get the mBean services caught programatically..can any one help me out

        • 1. Re: managing mBeans Programatically
          prese

          Hi,

          If I understood corectlly you want to access a MBean from a client, yes?
          If the client is in the same JVM it is quite easy:
          - locate first the MBeanServer using
          MBeanServerLocator.locate();
          - get a proxy to your MBean using
          MBeanProxy.get(...)

          If you try to get the MBean from a client outside of the JBOSS JVM you can try it via a RemoteAdapter(ex. RMIAdaptor) or using JBR.

          HTH

          • 2. Re: managing mBeans Programatically
            preeti123

            Thanks perse... U got my problem. But can u pls give me in detail how to do I locate the MBeanServer...

            And I am getting an error of unresolved name for RMIAdaptor if I am using that. should I import any specific class/interface

            Pls let me know as son as possible

            "prese" wrote:
            Hi,

            If I understood corectlly you want to access a MBean from a client, yes?
            If the client is in the same JVM it is quite easy:
            - locate first the MBeanServer using
            MBeanServerLocator.locate();
            - get a proxy to your MBean using
            MBeanProxy.get(...)

            If you try to get the MBean from a client outside of the JBOSS JVM you can try it via a RemoteAdapter(ex. RMIAdaptor) or using JBR.

            HTH


            • 3. Re: managing mBeans Programatically
              prese

              Hi,

              To find out how to use RMIAdaptor you can start with:

              http://www.jboss.org/wiki/Wiki.jsp?page=UsingTheRMIAdaptor.

              HTH

              • 4. Re: managing mBeans Programatically
                preeti123

                Hi,

                Thanks..But I am unable to resolve the errros even after using the RMIAdaptor....I am using :

                Properties props= new Properties();
                props.put(Context.PROVIDER_URL," jnp://localhost:1099");
                props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
                props.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
                Context ctx = new InitialContext(props);
                RMIAdaptor server = (RMIAdaptor)ctx.lookup("jmx/rmi/RMIAdaptor");
                jbMBeanServer = new RMIConnectorImpl(server);

                But I am getting the errors as

                Error: line (30) cannot resolve symbol class RMIAdaptor

                Error: line (31) cannot resolve symbol class RMIConnectorImpl

                Error: line (86) cannot resolve symbol class RMIAdaptor

                Error: line (86) cannot resolve symbol class RMIAdaptor

                Error: line (87) cannot resolve symbol class RMIConnectorImpl


                Pls help me out....


                "prese" wrote:
                Hi,

                To find out how to use RMIAdaptor you can start with:

                http://www.jboss.org/wiki/Wiki.jsp?page=UsingTheRMIAdaptor.

                HTH


                • 5. Re: managing mBeans Programatically
                  prese

                  Hi,

                  Just add to your classpath:
                  jmx-adaptor-plugin.jar or jbossall-client.jar.

                  Regards
                  Sebi

                  • 6. Re: managing mBeans Programatically
                    preeti123

                    Hi Sabi,

                    Thanks for the help.

                    But I want to know What are the files needs to be updated , the configuration & deployment details .

                    Right now I am just wriring the code and then including the jar file specified . Is there any thing else that needs to be done and can u pls help me out how do I access the MBeans from the server object returned. How do I register the mBeans with the server object?

                    Thank you and waiting for the reply
                    Preeti123

                    • 7. Re: managing mBeans Programatically
                      prese

                      Hi,

                      The MBeanServer that you obtained via RMIAdapter is a Proxy to MBean Server which resides inside of JBOSS server.
                      You can access the Mbeans using the proxy server methods, or better create you own invocation handler that is able to invoke the remote server.

                      I did not experience the registring of new MBeans via RMIAdaptor. You can try it ;).

                      HTH
                      Sebi