Github user pwendell commented on a diff in the pull request: https://github.com/apache/spark/pull/119#discussion_r10507796 --- Diff: core/src/main/scala/org/apache/spark/SparkContext.scala --- @@ -130,6 +130,16 @@ class SparkContext( val isLocal = (master == "local" || master.startsWith("local[")) + // Create a classLoader for use by the driver so that jars added via addJar are available to the + // driver. Do this before all other initialization so that any thread pools created for this + // SparkContext uses the class loader. + // Note that this is config-enabled as classloaders can introduce subtle side effects + private[spark] val classLoader = if (conf.getBoolean("spark.driver.loadAddedJars", false)) { + val loader = new SparkURLClassLoader(Array.empty[URL], this.getClass.getClassLoader) + Thread.currentThread.setContextClassLoader(loader) --- End diff -- Hey Sandy - not sure what you mean exactly by "load them for the SparkContext". The SparkContext is just a java object. The scenario we want to handle is like this: ``` val sc = new SparkContext(...) sc.addJar("jar-containing-lib-foo") val x: Seq[Foo] = sc.textFile(...).map(...).collect() ``` There are two ways "Foo" can be visible for the list line. Either it can be included in the classpath when launching the JVM or it can be added dynamically to the classloader of the calling thread. Is there another way?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---