Repository: spark Updated Branches: refs/heads/master 36ddeb7bf -> 6e3c5a296
[Test] Better exception message from SparkSubmitSuite Before: ``` Exception in thread "main" java.lang.Exception: Could not load user defined classes inside of executors at org.apache.spark.deploy.JarCreationTest$.main(SparkSubmitSuite.scala:471) at org.apache.spark.deploy.JarCreationTest.main(SparkSubmitSuite.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ``` After: ``` Exception in thread "main" java.lang.Exception: Could not load user class from jar: java.lang.UnsupportedClassVersionError: SparkSubmitClassA : Unsupported major.minor version 51.0 java.lang.ClassLoader.defineClass1(Native Method) java.lang.ClassLoader.defineClass(ClassLoader.java:643) ... at org.apache.spark.deploy.JarCreationTest$.main(SparkSubmitSuite.scala:472) at org.apache.spark.deploy.JarCreationTest.main(SparkSubmitSuite.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ``` Author: Andrew Or <and...@databricks.com> Closes #3212 from andrewor14/submit-suite-message and squashes the following commits: 7779248 [Andrew Or] Format exception 8fe6719 [Andrew Or] Better exception message from failed test Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/6e3c5a29 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/6e3c5a29 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/6e3c5a29 Branch: refs/heads/master Commit: 6e3c5a296c90a551be5e6c7292a66f2e65338240 Parents: 36ddeb7 Author: Andrew Or <and...@databricks.com> Authored: Wed Nov 12 13:35:48 2014 -0800 Committer: Andrew Or <and...@databricks.com> Committed: Wed Nov 12 13:35:48 2014 -0800 ---------------------------------------------------------------------- .../org/apache/spark/deploy/SparkSubmitSuite.scala | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/6e3c5a29/core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala ---------------------------------------------------------------------- diff --git a/core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala b/core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala index d8cd0ff..eb7bd7a 100644 --- a/core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala +++ b/core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala @@ -21,7 +21,7 @@ import java.io._ import scala.collection.mutable.ArrayBuffer -import org.apache.spark.{SparkConf, SparkContext, SparkEnv, SparkException, TestUtils} +import org.apache.spark._ import org.apache.spark.deploy.SparkSubmit._ import org.apache.spark.util.Utils import org.scalatest.FunSuite @@ -451,24 +451,25 @@ class SparkSubmitSuite extends FunSuite with Matchers { } } -object JarCreationTest { +object JarCreationTest extends Logging { def main(args: Array[String]) { Utils.configTestLog4j("INFO") val conf = new SparkConf() val sc = new SparkContext(conf) val result = sc.makeRDD(1 to 100, 10).mapPartitions { x => - var foundClasses = false + var exception: String = null try { Class.forName("SparkSubmitClassA", true, Thread.currentThread().getContextClassLoader) Class.forName("SparkSubmitClassA", true, Thread.currentThread().getContextClassLoader) - foundClasses = true } catch { - case _: Throwable => // catch all + case t: Throwable => + exception = t + "\n" + t.getStackTraceString + exception = exception.replaceAll("\n", "\n\t") } - Seq(foundClasses).iterator + Option(exception).toSeq.iterator }.collect() - if (result.contains(false)) { - throw new Exception("Could not load user defined classes inside of executors") + if (result.nonEmpty) { + throw new Exception("Could not load user class from jar:\n" + result(0)) } } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org