无法使用 Bahir 启动 Spark 应用程序

Unable to start Spark application with Bahir

我正在尝试 运行 Scala 中的 Spark 应用程序连接到 ActiveMQ。为此,我正在使用 Bahir format("org.apache.bahir.sql.streaming.mqtt.MQTTStreamSourceProvider")。当我在我的 built.sbt 中使用 Bahir2.2 时,应用程序 运行ning 正常,但将其更改为 Bahir3.0Bahir4.0 时,应用程序未启动,它是报错:

[error] (run-main-0) java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FSDataInputStream`

如何解决这个问题?是否有 Bahir 的替代品,我可以在我的 Spark-Structured-Streaming 中使用它来连接到 ActiveMQ 主题?

编辑: 我的 build.sbt

//For spark
libraryDependencies ++= Seq(
    "org.apache.spark" %% "spark-core" % "2.4.0" ,
    "org.apache.spark" %% "spark-mllib" % "2.4.0" ,
    "org.apache.spark" %% "spark-sql" % "2.4.0" ,
    "org.apache.spark" %% "spark-hive" % "2.4.0" ,
    "org.apache.spark" %% "spark-streaming" % "2.4.0" ,
    "org.apache.spark" %% "spark-graphx" % "2.4.0",
)

//Bahir
libraryDependencies += "org.apache.bahir" %% "spark-sql-streaming-mqtt" % "2.4.0"

好的,看来 spark2.4bahir2.4 之间存在某种兼容性问题。我通过将它们都回滚到 ver 2.3.

来修复它

这是我的build.sbt

name := "sparkTest"

version := "0.1"

scalaVersion := "2.11.11"

//For spark
libraryDependencies ++= Seq(
    "org.apache.spark" %% "spark-core" % "2.3.0" ,
    "org.apache.spark" %% "spark-mllib" % "2.3.0" ,
    "org.apache.spark" %% "spark-sql" % "2.3.0" ,
    "org.apache.spark" %% "spark-hive" % "2.3.0" ,
    "org.apache.spark" %% "spark-streaming" % "2.3.0" ,
    "org.apache.spark" %% "spark-graphx" % "2.3.0",
//    "org.apache.spark" %% "spark-streaming-kafka" % "1.6.3",
)

//Bahir
libraryDependencies += "org.apache.bahir" %% "spark-sql-streaming-mqtt" % "2.3.0"