gpt4 book ai didi

json - 当我尝试在 spark 上解析 Json 时出现 java.lang.NoSuchMethodError

转载 作者:行者123 更新时间:2023-12-01 15:35:25 24 4
gpt4 key购买 nike

我在尝试使用 com.typesafe.play play-json 2.4.0 时遇到问题在 Spark 上。以下代码在 spark 服务器上出现异常,但在我的电脑上运行良好。

val json = Json.parse(json_string)

异常:

java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonToken.id()I
at play.api.libs.json.jackson.JsValueDeserializer.deserialize(JacksonJson.scala:122)
at play.api.libs.json.jackson.JsValueDeserializer.deserialize(JacksonJson.scala:108)
at play.api.libs.json.jackson.JsValueDeserializer.deserialize(JacksonJson.scala:103)
at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:2860)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1569)
at play.api.libs.json.jackson.JacksonJson$.parseJsValue(JacksonJson.scala:226)
at play.api.libs.json.Json$.parse(Json.scala:21)
at org.soprism.kafka.connector.TwitterToCassandraPostsParser$.ParseJson(TwitterToCassandraPostsParser.scala:74)
at org.soprism.kafka.connector.TwitterToCassandraPostsParser$$anonfun$1$$anonfun$apply$1.apply(TwitterToCassandraPostsParser.scala:65)
at org.soprism.kafka.connector.TwitterToCassandraPostsParser$$anonfun$1$$anonfun$apply$1.apply(TwitterToCassandraPostsParser.scala:65)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
at org.apache.spark.rdd.RDD$$anonfun$foreach$1.apply(RDD.scala:798)
at org.apache.spark.rdd.RDD$$anonfun$foreach$1.apply(RDD.scala:798)
at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1503)
at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1503)
at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:61)
at org.apache.spark.scheduler.Task.run(Task.scala:64)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:203)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

我使用 spark-submit 命令来执行它

这似乎是 jackson 库的两个版本之间的不兼容。我该如何解决?

谢谢

最佳答案

Spark 节点不会检查您的依赖项。您需要构建一个包含所有依赖项的 uber-jar 并将其传递给 Spark,以便分发到不同的节点。

关于json - 当我尝试在 spark 上解析 Json 时出现 java.lang.NoSuchMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32142340/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com