diff --git a/impl/shim/mapreduce/src/main/java/org/pentaho/big/data/impl/shim/mapreduce/FutureMapReduceJobSimpleRunnable.java b/impl/shim/mapreduce/src/main/java/org/pentaho/big/data/impl/shim/mapreduce/FutureMapReduceJobSimpleRunnable.java index 896fe70e7ec..1669506a70e 100644 --- a/impl/shim/mapreduce/src/main/java/org/pentaho/big/data/impl/shim/mapreduce/FutureMapReduceJobSimpleRunnable.java +++ b/impl/shim/mapreduce/src/main/java/org/pentaho/big/data/impl/shim/mapreduce/FutureMapReduceJobSimpleRunnable.java @@ -94,7 +94,7 @@ protected void executeMainMethod( Class clazz, String commandLineArgs ) Method mainMethod = clazz.getMethod( "main", new Class[] { String[].class } ); Object[] args = ( commandLineArgs != null ) ? new Object[] { commandLineArgs.split( " " ) } : new Object[] { new String[ 0 ] }; - mainMethod.invoke( null, args ); + mainMethod.invoke( clazz.newInstance(), args ); } finally { Thread.currentThread().setContextClassLoader( cl ); } diff --git a/impl/shim/mapreduce/src/main/java/org/pentaho/big/data/impl/shim/mapreduce/MapReduceServiceImpl.java b/impl/shim/mapreduce/src/main/java/org/pentaho/big/data/impl/shim/mapreduce/MapReduceServiceImpl.java index 9951a74fca5..4b07345c07a 100644 --- a/impl/shim/mapreduce/src/main/java/org/pentaho/big/data/impl/shim/mapreduce/MapReduceServiceImpl.java +++ b/impl/shim/mapreduce/src/main/java/org/pentaho/big/data/impl/shim/mapreduce/MapReduceServiceImpl.java @@ -153,10 +153,10 @@ Class locateDriverClass( String driverClass, final URL resolvedJarUrl, final throws MapReduceExecutionException { try { if ( Utils.isEmpty( driverClass ) ) { + List> mainClasses = + jarUtility.getClassesInJarWithMain( resolvedJarUrl.toExternalForm(), shim.getClass().getClassLoader() ); Class mainClass = jarUtility.getMainClassFromManifest( resolvedJarUrl, shim.getClass().getClassLoader() ); if ( mainClass == null ) { - List> mainClasses = - jarUtility.getClassesInJarWithMain( resolvedJarUrl.toExternalForm(), shim.getClass().getClassLoader() ); if ( mainClasses.size() == 1 ) { return mainClasses.get( 0 ); } else if ( mainClasses.isEmpty() ) {