Skip to content

Commit 109d604

Browse files
committed
SPARK-1710: spark-submit should print better errors than "InvocationTargetException"
1 parent fb05432 commit 109d604

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.spark.deploy
1919

2020
import java.io.{File, PrintStream}
21+
import java.lang.reflect.InvocationTargetException
2122
import java.net.{URI, URL}
2223

2324
import scala.collection.mutable.{ArrayBuffer, HashMap, Map}
@@ -137,7 +138,7 @@ object SparkSubmit {
137138
throw new Exception(msg)
138139
}
139140
}
140-
141+
141142
// Special flag to avoid deprecation warnings at the client
142143
sysProps("SPARK_SUBMIT") = "true"
143144

@@ -253,7 +254,12 @@ object SparkSubmit {
253254

254255
val mainClass = Class.forName(childMainClass, true, loader)
255256
val mainMethod = mainClass.getMethod("main", new Array[String](0).getClass)
256-
mainMethod.invoke(null, childArgs.toArray)
257+
try {
258+
mainMethod.invoke(null, childArgs.toArray)
259+
} catch {
260+
case e: InvocationTargetException =>
261+
println("Exception in Invoked Method" + e.getTargetException)
262+
}
257263
}
258264

259265
private def addJarToClasspath(localJar: String, loader: ExecutorURLClassLoader) {

0 commit comments

Comments
 (0)