Source:
public void run() { try { final List<String> allCoordinates = new ArrayList<>(); if (coordinates != null) { allCoordinates.addAll(coordinates); } if (!noDefaultHadoop) { allCoordinates.addAll(DEFAULT_HADOOP_COORDINATES); } final List<URL> extensionURLs = new ArrayList<>(); for (final File extension : Initialization.getExtensionFilesToLoad(extensionsConfig)) { final ClassLoader extensionLoader = Initialization.getClassLoaderForExtension(extension, false); extensionURLs.addAll(Arrays.asList(((URLClassLoader) extensionLoader).getURLs())); } final List<URL> nonHadoopURLs = new ArrayList<>(Arrays.asList(((URLClassLoader) CliHadoopIndexer.class.getClassLoader()) .getURLs())); final List<URL> driverURLs = new ArrayList<>(nonHadoopURLs); for (File hadoopDependency : Initialization.getHadoopDependencyFilesToLoad(allCoordinates, extensionsConfig)) { final ClassLoader hadoopLoader = Initialization.getClassLoaderForExtension(hadoopDependency, false); driverURLs.addAll(Arrays.asList(((URLClassLoader) hadoopLoader).getURLs())); } final URLClassLoader loader = new URLClassLoader(driverURLs.toArray(new URL[0]), null); Thread.currentThread().setContextClassLoader(loader); final List<URL> jobUrls = new ArrayList<>(); jobUrls.addAll(nonHadoopURLs); jobUrls.addAll(extensionURLs); System.setProperty("druid.hadoop.internal.classpath", Joiner.on(File.pathSeparator).join(jobUrls)); final Class<?> mainClass = loader.loadClass(Main.class.getName()); final Method mainMethod = mainClass.getMethod("main", String[].class); String[] args = new String[]{ "internal", "hadoop-indexer", argumentSpec }; mainMethod.invoke(null, new Object[]{args}); } catch (Exception e) { log.error(e, "failure!!!!"); System.exit(1); } }

Target:
public void run() { try { final List<String> allCoordinates = new ArrayList<>(); if (coordinates != null) { allCoordinates.addAll(coordinates); } if (!noDefaultHadoop) { allCoordinates.addAll(DEFAULT_HADOOP_COORDINATES); } final List<URL> extensionURLs = new ArrayList<>(); for (final File extension : Initialization.getExtensionFilesToLoad(extensionsConfig)) { final URLClassLoader extensionLoader = Initialization.getClassLoaderForExtension(extension, false); extensionURLs.addAll(Arrays.asList(extensionLoader.getURLs())); } final List<URL> nonHadoopURLs = Arrays.asList( ((URLClassLoader) CliHadoopIndexer.class.getClassLoader()).getURLs() ); final List<URL> driverURLs = new ArrayList<>(nonHadoopURLs); for (File hadoopDependency : Initialization.getHadoopDependencyFilesToLoad(allCoordinates, extensionsConfig)) { final URLClassLoader hadoopLoader = Initialization.getClassLoaderForExtension(hadoopDependency, false); driverURLs.addAll(Arrays.asList(hadoopLoader.getURLs())); } final URLClassLoader loader = new URLClassLoader(driverURLs.toArray(new URL[0]), null); Thread.currentThread().setContextClassLoader(loader); final List<URL> jobUrls = new ArrayList<>(); jobUrls.addAll(nonHadoopURLs); jobUrls.addAll(extensionURLs); System.setProperty("druid.hadoop.internal.classpath", Joiner.on(File.pathSeparator).join(jobUrls)); final Class<?> mainClass = loader.loadClass(Main.class.getName()); final Method mainMethod = mainClass.getMethod("main", String[].class); String[] args = new String[]{ "internal", "hadoop-indexer", argumentSpec }; mainMethod.invoke(null, new Object[]{args}); } catch (Exception e) { log.error(e, "failure!!!!"); System.exit(1); } }