原因:java.lang.classnotfoundexception:org.apache.hadoop.hive.hbase.hivehbasetableinputformat

6qfn3psc  于 2021-06-09  发布在  Hbase
关注(0)|答案(1)|浏览(859)

我正在使用sparkauncher启动一个spark应用程序。在spark应用程序中,我将数据插入配置单元表,并在join查询中使用一些hbase配置单元链接表。我在spark launcher中添加了hive-hbase-handler-1.1.0-cdh5.13.0.jar,仍然是因为:java.lang.classnotfoundexception:org.apache.hadoop.hive.hbase.hivehbasetableinputformat我在sparklauncher中添加了jar错误:

def launch(hdfsFilePath:String):Unit={
    println("Inside ApplicationLauncher")
    val command = new SparkLauncher()
      .setAppResource("/home/cloudera/Desktop/Avi/LiveProjects/MusicDataAnalysis/target/scala-2.11/musicdataanalysis_2.11-0.1.jar")
      .setMainClass("ParseInputFile")
      .setVerbose(false)
      .addAppArgs(hdfsFilePath)
      .setMaster("local")
      .addJar("/home/cloudera/Desktop/Avi/jars/hive-hbase-handler-1.1.0-cdh5.13.0.jar")
      .addJar("/home/cloudera/Desktop/Avi/jars/spark-xml_2.11-0.5.0.jar")

    println("Done with Spark Launcher")
    val appHandle = command.startApplication()
    appHandle.addListener(new SparkAppHandle.Listener{
      def infoChanged(sparkAppHandle : SparkAppHandle) : Unit = {
      //  println(sparkAppHandle.getState + "  Custom Print")
      }

      def stateChanged(sparkAppHandle : SparkAppHandle) : Unit = {
        println(sparkAppHandle.getState)
        if ("FINISHED".equals(sparkAppHandle.getState.toString)){
          sparkAppHandle.stop
        }
      }
    })
lb3vh1jj

lb3vh1jj1#

我的问题在添加hbase-0.92.1.jar和hive-hbase-handler-1.1.0-cdh5.13.0.jar后得到了解决。请查找以下工作代码:

def launch(hdfsFilePath:String):Unit={
println("Inside ApplicationLauncher")
val command = new SparkLauncher()
  .setAppResource("/home/cloudera/Desktop/Avi/LiveProjects/MusicDataAnalysis/target/scala-2.11/musicdataanalysis_2.11-0.1.jar")
  .setMainClass("ParseInputFile")
  .setVerbose(false)
  .addAppArgs(hdfsFilePath)
  .setMaster("local")
  .addJar("file:///home/cloudera/Desktop/Avi/jars/hbase-0.92.1.jar")
  .addJar("file:///home/cloudera/Desktop/Avi/jars/hive-hbase-handler-3.1.1.jar")
  .addJar("file:///home/cloudera/Desktop/Avi/jars/spark-xml_2.11-0.5.0.jar")
println("Done with Spark Launcher")
val appHandle = command.startApplication()
appHandle.addListener(new SparkAppHandle.Listener{
  def infoChanged(sparkAppHandle : SparkAppHandle) : Unit = {
  //  println(sparkAppHandle.getState + "  Custom Print")
  }

  def stateChanged(sparkAppHandle : SparkAppHandle) : Unit = {
    println(sparkAppHandle.getState)
    if ("FINISHED".equals(sparkAppHandle.getState.toString)){
      sparkAppHandle.stop
    }
  }
})

}

相关问题