explicitly load spark env class first

This commit is contained in:
Kent Yao 2018-05-16 17:54:45 +08:00
parent dbe9cb30a3
commit be7639ae8b
2 changed files with 5 additions and 2 deletions

View File

@ -35,7 +35,7 @@ private[spark] class KyuubiFirstClassLoader(urls: Array[URL], parent: ClassLoade
override def loadClass(name: String, resolve: Boolean): Class[_] = {
try {
super.loadClass(name, true)
super.loadClass(name, resolve)
} catch {
case _: ClassNotFoundException =>
parentClassLoader.loadClass(name, resolve)

View File

@ -75,7 +75,10 @@ object KyuubiSparkUtil extends Logging {
// get kyuubi jar
val url = this.getClass.getProtectionDomain.getCodeSource.getLocation
info(s"Initializing KyuubiFirstClassLoader instance with url $url as first class members")
new KyuubiFirstClassLoader(Array(url), getContextOrSparkClassLoader())
val classLoader = new KyuubiFirstClassLoader(Array(url), getContextOrSparkClassLoader())
classLoader.loadClass("org.apache.spark.SparkEnv", true)
classLoader.loadClass("org.apache.spark.SparkEnv$", true)
classLoader
}
def addShutdownHook(f: () => Unit): Unit = {