你能通过livy运行scala代码而不上传jar吗?

0s0u357o  于 2021-07-09  发布在  Spark
关注(0)|答案(0)|浏览(257)

不上传jar就可以提交scala代码吗?我尝试了以下方法:

object LivySubmission {
  def main(args: Array[String]): Unit = {
    val client = new LivyClientBuilder(false)
      .setURI(new URI("http://localhost:8998/"))
      .build()
      .asScalaClient

    val job = client.run { context =>
      context.createStreamingContext(15000)
      1 + 1
    }

    job.onSuccess { case r => Console.println("1 + 1 = " + r) }
  }
}

结果是:

"log": [
        "Caused by: java.lang.ClassNotFoundException: org.apache.livy.scalaapi.LivyScalaClient$$anon$2",
        "\tat java.net.URLClassLoader.findClass(URLClassLoader.java:382)",
        "\tat java.lang.ClassLoader.loadClass(ClassLoader.java:418)",
        "\tat java.lang.ClassLoader.loadClass(ClassLoader.java:351)",
        "\tat java.lang.Class.forName0(Native Method)",
        "\tat java.lang.Class.forName(Class.java:348)",
        "\tat org.apache.livy.shaded.kryo.kryo.util.DefaultClassResolver.readName(DefaultClassResolver.java:136)",
        "\t... 40 more",
        "21/03/22 23:21:30 INFO ExecutorAllocationManager: Request to remove executorIds: 1",
        "\nYARN Diagnostics: "
      ]

它似乎试图加载提交给的匿名函数 client.run 却找不到,对吗?
我检查了这个问题,但答案是过时的,说你不能上传一个jar:运行livy作业通过http没有上传jar每次

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题