Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jackson version is too old

I have the following build.sbt file:

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",
)

However, when I am running the code, I get this error:

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

Why is this the case? I've added a newer version of Jackson to dependencyOverrides(after looking here Spark Parallelize? (Could not find creator property with name 'id')), so an older version shouldn't be used.

like image 934
octavian Avatar asked Oct 19 '22 04:10

octavian


1 Answers

jackson-core and jackson-databind versions should match (at least up to the minor version, I believe).

So remove the dependencyOverrides and have

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

Or specify both in dependencyOverrides

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

Though I'm not sure I understand what you are trying to do; the linked question seems to say that you should used an older version (2.4.4).

like image 170
Paul Draper Avatar answered Oct 21 '22 01:10

Paul Draper