Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spark com.fasterxml.jackson.module error

This is a bit strange. When running a very simple sparkContext.parallelize(List("1","2","3"))

I'm getting the following error:

java.lang.VerifyError: class com.fasterxml.jackson.module.scala.ser.ScalaIteratorSerializer overrides final method withResolved.(Lcom/fasterxml/jackson/databind/BeanProperty;Lcom/fasterxml/jackson/databind/jsontype/TypeSerializer;Lcom/fasterxml/jackson/databind/JsonSerializer;)Lcom/fasterxml/jackson/databind/ser/std/AsArraySerializerBase;

I guess there is some conflict in the dependencies of some of the libraries. My build.sbt looks like this:

scalaVersion := "2.11.7"

//Library repositories
resolvers ++= Seq(
  Resolver.mavenLocal,
  "Scala-Tools Maven2 Repository" at "http://scala-tools.org/repo-releases",
  "Java.net repository" at "http://download.java.net/maven/2",
  "GeoTools" at "http://download.osgeo.org/webdav/geotools",
  "Apache" at "https://repository.apache.org/service/local/repositories/releases/content",
  "Cloudera" at "https://repository.cloudera.com/artifactory/cloudera-repos/",
  "OpenGeo Maven Repository" at "http://repo.opengeo.org",
  "Typesafe" at "https://repo.typesafe.com/typesafe/releases/",
  "Spray Repository" at "http://repo.spray.io"
)

//Library versions
val geotools_version = "13.2"
val accumulo_version = "1.6.0-cdh5.1.4"
val hadoop_version = "2.6.0-cdh5.4.5"
val hadoop_client_version = "2.6.0-mr1-cdh5.4.5"
val geowave_version = "0.9.0-SNAPSHOT"
val akka_version = "2.4.0"
val spray_version = "1.3.3"
val spark_version = "1.5.0"

//Library Dependencies
libraryDependencies ++= Seq(
  //Scala
  "org.scala-lang" % "scala-library" % scalaVersion.value,
  "org.scala-lang" % "scala-reflect" % scalaVersion.value,

  //GeoTools
  "org.geotools" % "gt-data" % geotools_version,
  "org.geotools" % "gt-geojson" % geotools_version,

  //Apache
  "org.apache.accumulo" % "accumulo-core" % accumulo_version,
  "org.apache.hadoop" % "hadoop-common" % hadoop_version,
  "org.apache.hadoop" % "hadoop-client" % hadoop_client_version,

  //Geowave
  "mil.nga.giat" % "geowave-core-store" % geowave_version,
  "mil.nga.giat" % "geowave-datastore-accumulo" % geowave_version,
  "mil.nga.giat" % "geowave-adapter-vector" % geowave_version,

  //Other
  "com.typesafe" % "config" % "1.3.0",

  //Spray - Akka
  "com.typesafe.akka" %% "akka-actor" % akka_version,

  "io.spray" %% "spray-can" % spray_version,
  "io.spray" %% "spray-routing" % spray_version,
  "io.spray" %% "spray-testkit" % spray_version % "test",

  //Spark
  "org.apache.spark" %% "spark-core" % spark_version,

  "com.typesafe.play" %% "play-json" % "2.5.0-M1",

  //Testing
  "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"
).map(
  _.excludeAll(ExclusionRule(organization = "org.mortbay.jetty"))
)

test in assembly := {}

Any pointers on where to look?

Thanks

like image 553
Moises B. Avatar asked Nov 19 '15 22:11

Moises B.


3 Answers

Spring Boot 1.3.1 + Apache Spark 1.6.0 problem was resolved by adding dependency:

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.4.4</version>
   </dependency>

No excludes from any other dependency required.

like image 153
njjnex Avatar answered Nov 20 '22 09:11

njjnex


In effect, it was a dependency conflict due to json-play and spark using different versions of jackson data-bind. This build.sbt appears to solve the issue:

scalaVersion := "2.11.7"

//Library repositories
resolvers ++= Seq(
  Resolver.mavenLocal,
  "Scala-Tools Maven2 Repository" at "http://scala-tools.org/repo-releases",
  "Java.net repository" at "http://download.java.net/maven/2",
  "GeoTools" at "http://download.osgeo.org/webdav/geotools",
  "Apache" at "https://repository.apache.org/service/local/repositories/releases/content",
  "Cloudera" at "https://repository.cloudera.com/artifactory/cloudera-repos/",
  "OpenGeo Maven Repository" at "http://repo.opengeo.org",
  "Typesafe" at "https://repo.typesafe.com/typesafe/releases/",
  "Spray Repository" at "http://repo.spray.io"
)

//Library versions
val geotools_version = "13.2"
val accumulo_version = "1.6.0-cdh5.1.4"
val hadoop_version = "2.6.0-cdh5.4.5"
val hadoop_client_version = "2.6.0-mr1-cdh5.4.5"
val geowave_version = "0.9.0-SNAPSHOT"
val akka_version = "2.4.0"
val spray_version = "1.3.3"
val spark_version = "1.5.2"

//Library Dependencies
libraryDependencies ++= Seq(
  //Scala
  "org.scala-lang" % "scala-library" % scalaVersion.value,
  "org.scala-lang" % "scala-reflect" % scalaVersion.value,

  //GeoTools
  "org.geotools" % "gt-data" % geotools_version,
  "org.geotools" % "gt-geojson" % geotools_version,

  /** ********************************************** PROVIDED ****************************************/
  //  Apache
  //    "org.apache.accumulo" % "accumulo-core" % accumulo_version % "provided",
  //    "org.apache.hadoop" % "hadoop-common" % hadoop_version% "provided",
  //    "org.apache.hadoop" % "hadoop-client" % hadoop_client_version% "provided",
  //
  //    //Geowave
  //    "mil.nga.giat" % "geowave-core-store" % geowave_version % "provided",
  //    "mil.nga.giat" % "geowave-datastore-accumulo" % geowave_version % "provided",
  //    "mil.nga.giat" % "geowave-adapter-vector" % geowave_version % "provided",

  /** **********************************************************************************************/
  //Apache
  "org.apache.accumulo" % "accumulo-core" % accumulo_version,
  "org.apache.hadoop" % "hadoop-common" % hadoop_version,
  "org.apache.hadoop" % "hadoop-client" % hadoop_client_version,

  //Geowave
  "mil.nga.giat" % "geowave-core-store" % geowave_version,
  "mil.nga.giat" % "geowave-datastore-accumulo" % geowave_version,
  "mil.nga.giat" % "geowave-adapter-vector" % geowave_version,

  //Other
  "com.typesafe" % "config" % "1.3.0",

  //Spray - Akka
  "com.typesafe.akka" %% "akka-actor" % akka_version,

  "io.spray" %% "spray-can" % spray_version,
  "io.spray" %% "spray-routing" % spray_version,
  "io.spray" %% "spray-testkit" % spray_version % "test",
  "com.typesafe.play" %% "play-json" % "2.5.0-M1"
    exclude("com.fasterxml.jackson.core", "jackson-databind"),

  //Spark
  "org.apache.spark" %% "spark-core" % spark_version,

  //Testing
  "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"
).map(
  _.excludeAll(
    ExclusionRule(organization = "org.mortbay.jetty")
  )
)

test in assembly := {}
like image 38
Moises B. Avatar answered Nov 20 '22 10:11

Moises B.


Just add these lines in your SBT.

dependencyOverrides ++= Set(
  "com.fasterxml.jackson.core" % "jackson-databind" % "2.4.4"
)
like image 8
Dinesh Thalke Avatar answered Nov 20 '22 09:11

Dinesh Thalke