From 063e18f2898e1638fa472ebe71059d9c8dcb4c6f Mon Sep 17 00:00:00 2001 From: leapltw <444593771@qq.com> Date: Sun, 28 Oct 2018 11:16:41 +0800 Subject: [PATCH 1/2] Update MapReduceServiceImpl.java --- .../big/data/impl/shim/mapreduce/MapReduceServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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() ) { From 5c0ccd604be7e86cf311687c6bbf82be661081ae Mon Sep 17 00:00:00 2001 From: leapltw <444593771@qq.com> Date: Sun, 28 Oct 2018 11:31:23 +0800 Subject: [PATCH 2/2] method.invoke() this object can't be null method.invoke() this object can't be null,if this is null, it can be throw exception,it is not run successfully.so I fix it . --- .../impl/shim/mapreduce/FutureMapReduceJobSimpleRunnable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ); }