spark-core 依赖项中的冲突。它是如何工作的?
Conflicts in spark-core dependencies. How does it work?
我的问题的入口点是一个例外:
[info] Cause: com.fasterxml.jackson.databind.JsonMappingException: Incompatible Jackson version: 2.8.4
[info] at com.fasterxml.jackson.module.scala.JacksonModule.setupModule(JacksonModule.scala:64)
[info] at com.fasterxml.jackson.module.scala.JacksonModule.setupModule$(JacksonModule.scala:51)
[info] at com.fasterxml.jackson.module.scala.DefaultScalaModule.setupModule(DefaultScalaModule.scala:19)
[info] at com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:745)
[info] at org.apache.spark.rdd.RDDOperationScope$.<init>(RDDOperationScope.scala:82)
[info] at org.apache.spark.rdd.RDDOperationScope$.<clinit>(RDDOperationScope.scala)
[info] at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:152)
[info] at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:127)
[info] at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:83)
[info] at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:81)
Spark升级后出现。我设法克服了这个问题,但我仍然不明白根本原因。
看起来是 Spark 依赖问题,请看:
https://mvnrepository.com/artifact/org.apache.spark/spark-core_2.12/2.4.7
需要com.fasterxml.jackson.core » jackson-databind 2.6.7.3
。
没问题。
此外,它还需要:
https://mvnrepository.com/artifact/org.json4s/json4s-jackson_2.12/3.5.3
没问题。
但是,https://mvnrepository.com/artifact/org.json4s/json4s-jackson_2.12/3.5.3 需要 https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/2.8.4
现在,我们可以看到 spark-2.4.7
在 jackson-databind
本身之间引入了依赖冲突。我的推理哪里错了?
如您在 parent-pom 中所见,com.fasterxml.jackson.core.*
被排除在 json4s-jackson
之外:
https://github.com/apache/spark/blob/v2.4.7/pom.xml#L755
所以,毕竟没有冲突
我的问题的入口点是一个例外:
[info] Cause: com.fasterxml.jackson.databind.JsonMappingException: Incompatible Jackson version: 2.8.4
[info] at com.fasterxml.jackson.module.scala.JacksonModule.setupModule(JacksonModule.scala:64)
[info] at com.fasterxml.jackson.module.scala.JacksonModule.setupModule$(JacksonModule.scala:51)
[info] at com.fasterxml.jackson.module.scala.DefaultScalaModule.setupModule(DefaultScalaModule.scala:19)
[info] at com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:745)
[info] at org.apache.spark.rdd.RDDOperationScope$.<init>(RDDOperationScope.scala:82)
[info] at org.apache.spark.rdd.RDDOperationScope$.<clinit>(RDDOperationScope.scala)
[info] at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:152)
[info] at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:127)
[info] at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:83)
[info] at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:81)
Spark升级后出现。我设法克服了这个问题,但我仍然不明白根本原因。 看起来是 Spark 依赖问题,请看:
https://mvnrepository.com/artifact/org.apache.spark/spark-core_2.12/2.4.7
需要com.fasterxml.jackson.core » jackson-databind 2.6.7.3
。
没问题。
此外,它还需要:
https://mvnrepository.com/artifact/org.json4s/json4s-jackson_2.12/3.5.3
没问题。
但是,https://mvnrepository.com/artifact/org.json4s/json4s-jackson_2.12/3.5.3 需要 https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/2.8.4
现在,我们可以看到 spark-2.4.7
在 jackson-databind
本身之间引入了依赖冲突。我的推理哪里错了?
如您在 parent-pom 中所见,com.fasterxml.jackson.core.*
被排除在 json4s-jackson
之外:
https://github.com/apache/spark/blob/v2.4.7/pom.xml#L755
所以,毕竟没有冲突