gpt4 book ai didi

scala - Jackson 版本太旧了

转载 作者:行者123 更新时间:2023-12-04 20:34:22 26 4
gpt4 key购买 nike

我有以下 build.sbt文件:

name := "myProject"

version := "1.0"

scalaVersion := "2.11.8"

javaOptions ++= Seq("-Xms512M", "-Xmx2048M", "-XX:MaxPermSize=2048M", "-XX:+CMSClassUnloadingEnabled")


dependencyOverrides ++= Set(
"com.fasterxml.jackson.core" % "jackson-core" % "2.8.1"
)

// additional libraries
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "2.0.0" % "provided",
"org.apache.spark" %% "spark-sql" % "2.0.0" % "provided",
"org.apache.spark" %% "spark-hive" % "2.0.0" % "provided",
"com.databricks" %% "spark-csv" % "1.4.0",
"org.scalactic" %% "scalactic" % "2.2.1",
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
"org.scalacheck" %% "scalacheck" % "1.12.4",
"com.holdenkarau" %% "spark-testing-base" % "2.0.0_0.4.4" % "test",
)

但是,当我运行代码时,出现此错误:
An exception or error caused a run to abort. 
java.lang.ExceptionInInitializerError
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Jackson version is too old 2.4.4
at com.fasterxml.jackson.module.scala.JacksonModule$class.setupModule(JacksonModule.scala:56)
at com.fasterxml.jackson.module.scala.DefaultScalaModule.setupModule(DefaultScalaModule.scala:19)
at com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:549)
at org.apache.spark.rdd.RDDOperationScope$.<init>(RDDOperationScope.scala:82)
at org.apache.spark.rdd.RDDOperationScope$.<clinit>(RDDOperationScope.scala)
... 58 more

为什么会这样?
我已将较新版本的 Jackson 添加到 dependencyOverrides (查看这里后 Spark Parallelize? (Could not find creator property with name 'id') ),因此不应使用旧版本。

最佳答案

jackson-core 和 jackson-databind 版本应该匹配(至少到次要版本,我相信)。

所以删除 dependencyOverrides并且有

libraryDependencies ++= Seq(
...
"com.fasterxml.jackson.core" % "jackson-databind" % "2.8.1"
)

或者在 dependencyOverrides 中指定两者
dependencyOverrides ++= Set(
"com.fasterxml.jackson.core" % "jackson-core" % "2.8.1"
"com.fasterxml.jackson.core" % "jackson-databind" % "2.8.1"
)

虽然我不确定我是否理解你想要做什么;链接的问题似乎说您应该使用旧版本(2.4.4)。

关于scala - Jackson 版本太旧了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38686318/

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