使用URLClassLoader时无法在Scala Shell中加载类

时间:2019-06-15 13:34:41

标签: scala classloader scala-shell

我在我的应用程序中嵌入了scala shell,并通过URLClassLoader创建了scala shell(此URLClassLoader将加载我自定义的类并将其绑定到scala shell中)。我遇到的奇怪问题是我无法在scala shell中绑定我的自定义类变量。但是,如果我将自定义类文件放在URLClassLoader之外,它将起作用。谁能告诉我这是怎么回事。我该如何解决?我想它应该与ClassLoader有关,但不确定如何通过scala shell api对其进行修复。

21:25:55,144 DEBUG org.apache.zeppelin.spark.SparkScala211Interpreter:81 - Interpreter output:<console>:5: error: type SparkZeppelinContext is not a member of package org.apache.zeppelin.spark
21:25:55,144 DEBUG org.apache.zeppelin.spark.SparkScala211Interpreter:81 - Interpreter output:  var value: org.apache.zeppelin.spark.SparkZeppelinContext = _
21:25:55,145 DEBUG org.apache.zeppelin.spark.SparkScala211Interpreter:81 - Interpreter output:                                       ^
21:25:55,161 DEBUG org.apache.zeppelin.spark.SparkScala211Interpreter:81 - Interpreter output:<console>:6: error: type SparkZeppelinContext is not a member of package org.apache.zeppelin.spark
21:25:55,162 DEBUG org.apache.zeppelin.spark.SparkScala211Interpreter:81 - Interpreter output:  def set(x: Any) = value = x.asInstanceOf[org.apache.zeppelin.spark.SparkZeppelinContext]
21:25:55,164 DEBUG org.apache.zeppelin.spark.SparkScala211Interpreter:81 - Interpreter output:  

0 个答案:

没有答案