这有点奇怪。运行非常简单的sparkContext.parallelize(List("1","2","3"))
我收到以下错误:
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;
我猜某些库的依赖关系存在一些冲突。我的build.sbt看起来像这样:
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 := {}
关于在哪里寻找的任何指示?
由于
答案 0 :(得分:19)
Spring Boot 1.3.1 + Apache Spark 1.6.0问题通过添加依赖项解决:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.4</version>
</dependency>
不排除任何其他必需的依赖。
答案 1 :(得分:10)
实际上,由于使用不同版本的jackson data-bind的json-play和spark,这是一个依赖冲突。这build.sbt
似乎解决了这个问题:
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 := {}
答案 2 :(得分:8)
只需在SBT中添加这些行。
dependencyOverrides ++= Set(
"com.fasterxml.jackson.core" % "jackson-databind" % "2.4.4"
)
答案 3 :(得分:0)
在同一个项目中使用Spring Boot和Spark可能会遇到同样的问题。以防万一 - 从Spark以外的其他项目中排除jackson-databind依赖项。
答案 4 :(得分:0)
我也有同样的问题,njjnex解决方案对我有用!我使用Spring Boot 1.3.3 + Spark 1.6.1和Gradle 2.9作为构建工具。以下是Gradle用户的解决方案:
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.4.4'
如果您遇到问题,可以尝试使用其他版本here(适用于Maven和SBT用户)
答案 5 :(得分:0)
如果您有jackson-core-asl和jackson-mapper-asl,请删除它们。这使我类似的问题起作用。
答案 6 :(得分:0)
如果有人使用Maven进行构建管理,则该版本与Spark版本2.11
兼容。已针对jackson
至2.9.0的所有版本进行测试。仅此组合有效。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foreverLearn</groupId>
<artifactId>ClusteringIndustry</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<jackson.version>2.6.0</jackson.version>
<spark.version>2.3.0</spark.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-core -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-sql -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>${spark.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-mllib -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>${spark.version}</version>
<!-- <scope>runtime</scope> -->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-aws</artifactId>
<version>2.7.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-aws -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.660</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
</dependencies>
</project>