private Class<?> getServiceLevelServerActionClass(String classname, Map<String, ServiceInfo> services) {
      List<URL> urls = new ArrayList<>();
      for (ServiceInfo service : services.values()) {
        LOG.debug(String.format("Checking service %s", service));
        File dir = service.getServerActionsFolder();
        if ( dir != null) {
          LOG.debug(String.format("Service %s, external dir %s",service.getName(), dir.getAbsolutePath()));
          File[] jars = dir.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
              LOG.debug(String.format("Checking folder %s", name));
              return name.endsWith(".jar");
            }
          });
          for (File jar : jars) {
            try {
              URL url = jar.toURI().toURL();
              urls.add(url);
              LOG.info("Adding server action jar to classpath: {}", url);
            }
            catch (Exception e) {
              LOG.error("Failed to add server action jar to classpath: {}", jar.getAbsolutePath(), e);
            }
          }
        } else {
          LOG.error(String.format("%s service server actions folder returned null", service));
        }
      }

      ClassLoader classLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]), ClassUtils.getDefaultClassLoader());
      Class<?> actionClass = null;
      try {
        actionClass = ClassUtils.resolveClassName(classname, classLoader);
        LOG.debug(String.format("Found external server action %s", classname));
      } catch(IllegalArgumentException illegalArgumentException) {
        LOG.error(String.format("Unable to find server action %s in external server action directories", classname), illegalArgumentException);
      }

      return actionClass;
    }
Load server action classes defined in the service level Jar files
ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java