From 18fab6811bd07aa187228125c32a61bc7f56f452 Mon Sep 17 00:00:00 2001 From: Rajat Khandelwal Date: Wed, 29 Dec 2021 14:40:42 +0530 Subject: [PATCH] [LIVY-880] Use require api to add jars to classpath. --- .../main/scala/org/apache/livy/repl/SparkInterpreter.scala | 7 +++++-- .../main/scala/org/apache/livy/repl/SparkInterpreter.scala | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/repl/scala-2.11/src/main/scala/org/apache/livy/repl/SparkInterpreter.scala b/repl/scala-2.11/src/main/scala/org/apache/livy/repl/SparkInterpreter.scala index 98c478f35..05b076697 100644 --- a/repl/scala-2.11/src/main/scala/org/apache/livy/repl/SparkInterpreter.scala +++ b/repl/scala-2.11/src/main/scala/org/apache/livy/repl/SparkInterpreter.scala @@ -74,8 +74,11 @@ class SparkInterpreter(protected override val conf: SparkConf) extends AbstractS Paths.get(u.toURI).getFileName.toString.contains("org.scala-lang_scala-reflect") } - extraJarPath.foreach { p => debug(s"Adding $p to Scala interpreter's class path...") } - sparkILoop.addUrlsToClassPath(extraJarPath: _*) + extraJarPath.foreach { p => + debug(s"Adding $p to Scala interpreter's class path...") + sparkILoop.require(new File(p.toURI).getPath) + } + classLoader = null } else { classLoader = classLoader.getParent diff --git a/repl/scala-2.12/src/main/scala/org/apache/livy/repl/SparkInterpreter.scala b/repl/scala-2.12/src/main/scala/org/apache/livy/repl/SparkInterpreter.scala index bb8f7e594..abaff845c 100644 --- a/repl/scala-2.12/src/main/scala/org/apache/livy/repl/SparkInterpreter.scala +++ b/repl/scala-2.12/src/main/scala/org/apache/livy/repl/SparkInterpreter.scala @@ -74,8 +74,10 @@ class SparkInterpreter(protected override val conf: SparkConf) extends AbstractS Paths.get(u.toURI).getFileName.toString.contains("org.scala-lang_scala-reflect") } - extraJarPath.foreach { p => debug(s"Adding $p to Scala interpreter's class path...") } - sparkILoop.addUrlsToClassPath(extraJarPath: _*) + extraJarPath.foreach { p => + debug(s"Adding $p to Scala interpreter's class path...") + sparkILoop.require(new File(p.toURI).getPath) + } classLoader = null } else { classLoader = classLoader.getParent