我已經添加了
"org.apache.bahir" %% "spark-streaming-mqtt" % "2.4.0"
到我的build.sbt,并使用
df
.writeStream
.format("org.apache.bahir.sql.streaming.mqtt.MQTTStreamSinkProvider")
.outputMode("complete")
.option("topic", "mytopic")
.option("brokerUrl", "tcp://localhost:1883")
.start()
.awaitTermination(20000)
在代碼中,但得到
java.lang.ClassNotFoundException: Failed to find data source: org.apache.bahir.sql.streaming.mqtt.MQTTStreamSinkProvider. Please find packages at http://spark.apache.org/third-party-projects.html
at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:679)
uj5u.com熱心網友回復:
我已經意識到這種行為的原因是使用了錯誤的依賴"org.apache.bahir" %% "spark-streaming-mqtt" % "2.4.0"而不是"org.apache.bahir" %% "spark-sql-streaming-mqtt" % "2.4.0"
修復后我遇到了新問題
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/322632.html
