7 Replies Latest reply on Aug 17, 2006 4:47 PM by peterj

    JBoss MBean API

    yizhao

      Hi everyone,

      I'm writing a java program to monitor the status of a remote JBoss server. My current status is that I am able to connect to the JBoss server. I want to be able to get server information like heap size, connection pool information, etc... So far all I've been able to get is the version number and a list of domains. Is there an api that lists all the mbeans and there attributes? If not, how can I go about getting the before mentioned server information? Thanks in advance for any advice.

        • 1. Re: JBoss MBean API
          peterj

          The MBeanServerConnection class contains many methods that will help you find what you need. See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=84303
          for some example code.

          See http://java.sun.com/j2ee/1.4/docs/api/javax/management/MBeanServerConnection.html for the API.

          • 2. Re: JBoss MBean API
            yizhao

            Hi,

            Thanks for that info. I didn't state my question too clearly but I was actually asking a slitly different question. For example, after I establish a connection with the JBoss AS, if I wanted to get the version number I would do the following:

            ObjectName on = new ObjectName("jboss.system:type=Server");
            Object ver = server.getAttribute(on, "VersionName");
            System.out.println("Version " + ver);

            After starting the server, from the web-console page, under "System->JMX Mbeans", there is a list of mbeans and associated attributes. I am having trouble finding the MBeans and attributes that I need. For example, JVM heap size, current heap usage, JDBCDataSourceRuntime info, ExecuteQueue info, OpenSocketsCurrentCount, SocketsOpenedTotalCount.

            Thanks!

            • 3. Re: JBoss MBean API
              peterj

              Here are a few to get started with:

              Data source connection pool information for datasource named XXX: jboss.jca:name=XXX,service=ManagedConnectionPool

              Heap info: jboss.system:type=ServerInfo

              Socket information (aka threads) for port 8080: jboss.web:name=http-0.0.0.0-8080,type=ThreadPool

              By the way, it might be easier to use the jmx-console than the web console to locate and browse through the mbeans.

              • 4. Re: JBoss MBean API
                j_mmontero

                Hi yizhao,

                Could you please post how you are doing the connection to the remote Jboss Server?

                • 5. Re: JBoss MBean API
                  peterj

                  Did you see the link to the example code in my earlier reply? That is a stand-alone client application that connects to an mbean server. Just change the "localhost" in the URL to your remote host name.

                  • 6. Re: JBoss MBean API
                    j_mmontero

                    Thxs Peter,

                    When I try to run the java program I got the following Exception
                    javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: org.jboss.jmx.adaptor.rmi.RMIAdaptor (no security manager: RMI class loader disabled)]
                    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713)
                    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
                    at javax.naming.InitialContext.lookup(Unknown Source)
                    at ExClient.main(ExClient.java:20)

                    Any Help would be appreciated!

                    • 7. Re: JBoss MBean API
                      peterj