code: public static MBeanServer getMBeanServer(String domain)
     {
        try
        {
           ArrayList<MBeanServer> l = MBeanServerFactory.findMBeanServer(null);
  
           if (l != null)
           {
              for (MBeanServer ms : l)
              {
                 String[] domains = ms.getDomains();
  
                 if (domains != null)
                 {
                    for (String d : domains)
                    {
                       if (domain.equals(d))
                       {
                          return ms;
                       }
                    }
                 }
              }
           }
        }
        catch (SecurityException se)
        {
           // Ignore
        }
  
        return null;
     }
docs: Get the MBeanServer instance
  @param domain The domain
  @return The instance