0 Replies Latest reply on Sep 9, 2010 5:19 AM by Ramesh Bahavathi

    Mbean - Jboss 5.0 for getting Servlet and EJB Details

    Ramesh Bahavathi Newbie

      Hi..

               Iam using this code for getting servlet and EJB details up to Jboss 4.2.But this code not working in Jboss 5.0 Version.Is any changes in MBean.Here with i have attached code also.

       

                   ObjectName objectname = new ObjectName("*:j2eeType=Servlet,*");
                  Set set = mbs.queryMBeans(objectname, null);
                  Properties ret_props = new Properties();
                  for(Iterator iterator = set.iterator(); iterator.hasNext();)
                  {
                      Properties properties = new Properties();
                      ObjectInstance objectinstance = (ObjectInstance)iterator.next();
                      String s = objectinstance.getClassName();
                      String s_infoName = "";
                     if(s.equals("org.jboss.management.j2ee.Servlet")){
           ObjectName servlet_obj = objectinstance.getObjectName();
           String s_j2eeServer = servlet_obj.getKeyProperty("J2EEServer");
           String s_webModule = servlet_obj.getKeyProperty("WebModule");
           String s_servletName = servlet_obj.getKeyProperty("name");
           s_infoName = s_j2eeServer+"_"+s_webModule+"_"+s_servletName;
           //s_webModule = replace(s_webModule,".","_");
           properties.setProperty("InvocationTotalCount", "0");
           properties.setProperty("ExecutionTimeTotal", "0");
           properties.setProperty("ExecutionTimeHigh", "0");
           //properties.setProperty("ExecutionTimeLow", "0");
           //properties.setProperty("ExecutionTimeAverage", "0");
           Boolean boolean1 = (Boolean)getAttribute(servlet_obj, "StatisticsProvider", true);
           if(boolean1.booleanValue())
           {
            Stats stats = (Stats)getAttribute(servlet_obj, "Stats", true);
            updateServletStats(properties, stats);
           }
           ret_props.put(s_infoName,properties);
          }
             

       

      Thanks

      Ramesh K B