@@ -21,7 +21,7 @@ import java.io._
2121
2222import scala .collection .mutable .ArrayBuffer
2323
24- import org .apache .spark .{ SparkConf , SparkContext , SparkEnv , SparkException , TestUtils }
24+ import org .apache .spark ._
2525import org .apache .spark .deploy .SparkSubmit ._
2626import org .apache .spark .util .Utils
2727import org .scalatest .FunSuite
@@ -451,24 +451,24 @@ class SparkSubmitSuite extends FunSuite with Matchers {
451451 }
452452}
453453
454- object JarCreationTest {
454+ object JarCreationTest extends Logging {
455455 def main (args : Array [String ]) {
456456 Utils .configTestLog4j(" INFO" )
457457 val conf = new SparkConf ()
458458 val sc = new SparkContext (conf)
459459 val result = sc.makeRDD(1 to 100 , 10 ).mapPartitions { x =>
460- var foundClasses = false
460+ var exception : String = null
461461 try {
462462 Class .forName(" SparkSubmitClassA" , true , Thread .currentThread().getContextClassLoader)
463463 Class .forName(" SparkSubmitClassA" , true , Thread .currentThread().getContextClassLoader)
464- foundClasses = true
465464 } catch {
466- case _ : Throwable => // catch all
465+ case t : Throwable =>
466+ exception = t + " \n " + t.getStackTraceString
467467 }
468- Seq (foundClasses) .iterator
468+ Option (exception).toSeq .iterator
469469 }.collect()
470- if (result.contains( false ) ) {
471- throw new Exception (" Could not load user defined classes inside of executors " )
470+ if (result.nonEmpty ) {
471+ throw new Exception (" Could not load user class from jar: \n " + result( 0 ) )
472472 }
473473 }
474474}
0 commit comments