code: protected static void validateMBean(Class interfaceClass, ObjectName objectName, MBeanServerConnection mBeanServerConnection)  throws MBeanException {
  
          try {
  
              // Check if the interface class is null.
              if (interfaceClass == null) {
                  throw new IllegalArgumentException(
                          "The interface class is null.");
              }
              
              // Check if the interface class is not a MXBean interface.
              if (!JMX.isMXBeanInterface(interfaceClass)) {
                  throw new IllegalArgumentException(
                          "The interface class " + interfaceClass.getName() +
                          " is not a MXBean interface.");
              }
  
              // Check if the object name is not registered.
              if (!mBeanServerConnection.isRegistered(objectName)) {
                  throw new IllegalArgumentException(
                          "The object name " + objectName.getCanonicalName() +
                          " is not registered.");
              }
  
              // Check if the object name is not an instance of the interface class.
              if (!mBeanServerConnection.isInstanceOf(objectName, interfaceClass.getName())) {
                  throw new IllegalArgumentException(
                          "The object name " + objectName.getCanonicalName() +
                          " is not an instance of the interface class " +
                          interfaceClass.getName() + ".");
              }
          } catch (InstanceNotFoundException e) {
              throw new IllegalArgumentException(
                      "The object name " + objectName.getCanonicalName() +
                      " is not found.");
          } catch (IOException e) {
              throw new MBeanException(e,
                      "Unable to validate the MBean represented by the interface class " +
                      interfaceClass.getName() + " and object name " +
                      objectName.getCanonicalName() + ".");
          }
      }
docs: Validate the MBean represented by the interface class and object name.
  
  @param  interfaceClass         the MBean interface class.
  @param  objectName             the MBean object name.
  @param  mBeanServerConnection  the MBean server connection.
  
  @throws  IllegalArgumentException  if the MBean is invalid.
  @throws  IOException               if unable to validate the MBean.