2 Replies Latest reply on Jun 9, 2010 1:58 PM by vsrivastav

    JBoss: Query JMX agent to find all deployed war

    vsrivastav

      How can I query JBoss to find all deployed war files. Basicall I want to programatically quest the view that the following filter presents in the JMX console:

       

      jboss.web.deployment

       

      Much appreciate your help.

      Vivek

        • 1. Re: JBoss: Query JMX agent to find all deployed war
          peterj

          Vivek, welcome to the JBoss forums!

           

          You can do this using twiddle from the command line as follows:

           

          twiddle query "jboss.web.deployment:*"

           

          Prgrammatically, you would create an ObjectName using "jboss.web.deployment:*" and pass that to the MBeanServerConnection.queryMBeans method.to the

          • 2. Re: JBoss: Query JMX agent to find all deployed war
            vsrivastav

            Thanks Peter. That was helpful.

             

                    try {
                        Context ctx = new javax.naming.InitialContext();
                        ObjectName obj = new ObjectName("jboss.web.deployment:*");
                        MBeanServerConnection c = (MBeanServerConnection) ctx.lookup("jmx/invoker/RMIAdaptor");
                        Set<ObjectInstance> set = c.queryMBeans(obj, null);
                        for(ObjectInstance oi : set){
                            log.info(oi.getObjectName().getCanonicalName());
                        }
                    } catch (IOException ex) {
                        Logger.getLogger(UIMgrService.class.getName()).log(Level.SEVERE, null, ex);
                    }

             

            Regards

            Vivek