当我尝试使用com.typesafe.play play-json 2.4.0时,我遇到了问题 在火花上。 以下代码在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命令执行它
两个版本的杰克逊图书馆似乎不相容。我该如何解决?
谢谢
答案 0 :(得分:1)
Spark节点不会检查您的依赖项。您需要构建一个包含所有依赖项的超级jar,并将其传递给Spark,以便分发到不同的节点。
答案 1 :(得分:0)
Oozie在共享的lib fodler中有很多过时的jackson库:
[cloudera@quickstart oozie]$ sudo -u hdfs hadoop fs -ls -R /user/oozie/share | grep -i jackson-core
-rwxrwxrwx 1 oozie supergroup 191738 2015-11-18 03:00 /user/oozie/share/lib/hive/jackson-core-2.2.2.jar
-rw-r--r-- 1 oozie supergroup 191738 2015-11-18 03:02 /user/oozie/share/lib/lib_20151118030154/hcatalog/jackson-core-2.2.2.jar
-rw-r--r-- 1 oozie supergroup 227500 2015-11-18 03:02 /user/oozie/share/lib/lib_20151118030154/hcatalog/jackson-core-asl-1.8.8.jar
-rw-r--r-- 1 oozie supergroup 191738 2015-11-18 03:02 /user/oozie/share/lib/lib_20151118030154/hive/jackson-core-2.2.2.jar
-rw-r--r-- 1 oozie supergroup 227500 2015-11-18 03:02 /user/oozie/share/lib/lib_20151118030154/hive/jackson-core-asl-1.8.8.jar
-rw-r--r-- 1 oozie supergroup 227500 2015-11-18 03:02 /user/oozie/share/lib/lib_20151118030154/hive2/jackson-core-asl-1.8.8.jar
-rw-r--r-- 1 oozie supergroup 227500 2015-11-18 03:01 /user/oozie/share/lib/lib_20151118030154/pig/jackson-core-asl-1.8.8.jar
-rw-r--r-- 1 oozie supergroup 192699 2015-11-18 03:02 /user/oozie/share/lib/lib_20151118030154/spark/jackson-core-2.2.3.jar
-rw-r--r-- 1 oozie supergroup 227500 2015-11-18 03:02 /user/oozie/share/lib/lib_20151118030154/spark/jackson-core-asl-1.8.8.jar
-rw-r--r-- 1 oozie supergroup 197986 2015-11-18 03:02 /user/oozie/share/lib/lib_20151118030154/sqoop/jackson-core-2.3.1.jar
-rwxrwxrwx 1 oozie supergroup 227500 2015-11-18 03:00 /user/oozie/share/lib/pig/jackson-core-asl-1.8.8.jar
-rwxrwxrwx 1 oozie supergroup 195678 2015-11-18 03:00 /user/oozie/share/lib/sqoop/jackson-core-2.3.1.jar
-rwxrwxrwx 1 oozie supergroup 224637 2015-11-18 03:00 /user/oozie/share/lib/sqoop/jackson-core-asl-1.8.8.jar
[cloudera@quickstart oozie]$
在workflow.xml中使用以下道具:
<property>
<name>oozie.launcher.mapreduce.task.classpath.user.precedence</name>
<value>true</value>
</property>
这是Oozie的一个错误。查看以下链接了解详情:
https://issues.apache.org/jira/browse/OOZIE-2066
http://gbif.blogspot.com.by/2014/11/upgrading-our-cluster-from-cdh4-to-cdh5.html
不要忘记在Uber jar中添加jackson for Oozie lib。