8 Replies Latest reply on Jan 16, 2009 12:59 AM by priyapg

    jboss monitoring

    priyapg

      how jboss details can be retreived from mbeans?the parameters are Monitor information (JVM usage,Listen port,activation time etc),Web Application Details(Web Application name,context root,reponse type etc),JDBC Connection Pool details(JDBC pool,pool size,connections currently in use,connections destroyed etc),EJB Details (EJB Name,Module,Type etc).Please help it's urgent............

        • 1. Re: jboss monitoring
          mlange

          Simply collect all mbeans and the corresponding JMX object names and read the JMX docs how get the attributes.

          • 2. Re: jboss monitoring
            peterj

            Use the jmx console (http://localhost:8080/jmx-console) to browse the mbeans, looking for the information you want. Then you can write your own code to access the same info, or even use twiddle to access it (which one you do depends on what you want to do with the data).

            • 3. Re: jboss monitoring
              peterj
              • 4. Re: jboss monitoring
                priyapg

                Here is my code to extract info from mbean ,but the set size returns zero.So not getting info on mbeans.Can u plz help me on this?
                JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://10.200.9.148:9900/jmxrmi");
                JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
                MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

                ObjectName pattern=new ObjectName("jboss.jmx:*");
                Set res = mbsc.queryNames(pattern,null);
                System.out.println("set size="+res.size());
                for (Iterator i = res.iterator(); i.hasNext(); ) {
                ObjectName o = (ObjectName)i.next();
                System.out.println("MBean: " + o);
                MBeanAttributeInfo[] info = mbsc.getMBeanInfo(o).getAttributes();
                for (int j=0 ; j< info.length; j++) {
                MBeanAttributeInfo beanInfo = info[j];
                final String attrname = beanInfo.getName();
                System.out.println("\t"+attrname+"="+mbsc.getAttribute(o,attrname));

                }
                }

                • 5. Re: jboss monitoring
                  priyapg

                  Also I tried using RMIAdaptor .The following is the error coming.I am stuck here.

                  Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
                  at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
                  at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
                  at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
                  at javax.naming.InitialContext.lookup(InitialContext.java:351)
                  at JMXBrowser.main(JMXBrowser.java:28)

                  • 6. JBoss Logging

                    Hi

                    Can anyone tell which mbean i should i use so that my java file get initialized properly at deployment time, when server configure log4j.xml.

                    • 7. Re: jboss monitoring
                      peterj

                      div_gcet1, please to not hijack other's topics.

                      priyapg, see if this helps: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=134247

                      • 8. Re: jboss monitoring
                        priyapg

                        Thanks a lot....your post regarding jndi helps me .I was struggling with it..