我在 Spark Yarn 上运行工作并尝试向 Influx DB 发送消息,但我在 okio 冲突中崩溃:
22:17:54 ERROR ApplicationMaster - User class threw exception: java.lang.NoSuchMethodError: okio.BufferedSource.readUtf8LineStrict(J)Ljava/lang/String;
java.lang.NoSuchMethodError: okio.BufferedSource.readUtf8LineStrict(J)Ljava/lang/String;
at okhttp3.internal.http1.Http1Codec.readHeaderLine(Http1Codec.java:212)
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
这是我的依赖项:
val cdhVersion = "cdh5.12.2"
val sparkVersion = "2.2.0.cloudera2"
val parquetVersion = s"1.5.0-$cdhVersion"
val hadoopVersion = s"2.6.0-$cdhVersion"
val awsVersion = "1.11.295"
val log4jVersion = "1.2.17"
val slf4jVersion = "1.7.5"
lazy val sparkDependencies = Seq(
"org.apache.spark" %% "spark-core" % sparkVersion,
"org.apache.spark" %% "spark-hive" % sparkVersion,
"org.apache.spark" %% "spark-sql" % sparkVersion,
"org.apache.spark" %% "spark-streaming" % sparkVersion,
"org.apache.hadoop" % "hadoop-common" % "2.2.0"
)
lazy val otherDependencies = Seq(
"org.apache.spark" %% "spark-streaming-kinesis-asl" % "2.2.0",
"org.clapper" %% "grizzled-slf4j" % "1.3.1",
"org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.6.2" % "runtime",
"org.slf4j" % "slf4j-log4j12" % slf4jVersion,
"com.typesafe" % "config" % "1.3.1",
"org.rogach" %% "scallop" % "3.0.3",
"org.influxdb" % "influxdb-java" % "2.9"
)
libraryDependencies ++= sparkDependencies.map(_ % "provided" ) ++ otherDependencies
dependencyOverrides ++= Set("com.squareup.okio" % "okio" % "1.13.0")
使用同一个 jar,我可以运行成功的测试以在非火花作业中实例化 InfluxDb 实例。但是尝试从 Spark 中执行一些操作会引发上述错误。听起来 spark 必须有它自己的 OKIO 版本,当我使用 spark-submit 时,这会在运行时导致这种冲突。...但是当我转储依赖树时,它并没有显示出来。关于如何将我想要的 okio 1.13.0 版本带到 spark 集群运行路径的任何建议?
(当我打字时,我正在考虑尝试着色,我现在将这样做)谢谢