question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jackson-databind conflicts with Spark's

See original GitHub issue

I am trying reading a CSV file using dataframes (Spark 2.2.0) like so:

Dataset<Row> df = spark.read()
			.format("csv")
			.option("sep", "\t")
			.option("header", "true")
			.option("inferSchema", "true")
			.load("/tmp/example.csv");

This fails with a Exception in thread "main" java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isReferenceType()Z exception. This is the content of the pom.xml file:

<dependencies>
  	<dependency>
  		<groupId>org.apache.spark</groupId>
  		<artifactId>spark-core_2.11</artifactId>
  		<version>2.2.0</version>
  	</dependency>
  	<dependency>
  		<groupId>org.apache.spark</groupId>
  		<artifactId>spark-sql_2.11</artifactId>
  		<version>2.2.0</version>
  	</dependency>
  	<dependency>
  		<groupId>com.lucidworks.spark</groupId>
  		<artifactId>spark-solr</artifactId>
  		<version>3.2.0</version>
  	</dependency>
</dependencies>

The jackson-databind version (2.4.0) is omitted due to a conflict with Spark’s 2.6.5 version. Can it be updated?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
nvituccicommented, Oct 12, 2017

Excluding any version of jackson-databind does not work. Adding it explicitly to the pom file (together with its related packages) apparently solves the problem:

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>2.6.5</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-annotations</artifactId>
  <version>2.6.5</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-core</artifactId>
  <version>2.6.5</version>
</dependency>
1reaction
jackson-chriscommented, Aug 24, 2018

Just stumbled across this same problem. I believe the correct solution when targeting spark 2.2.0 and spark-solr 3.3.4 version is to just list the spark-solr dependency as follows:

<dependency>
  <groupId>com.lucidworks.spark</groupId>
  <artifactId>spark-solr</artifactId>
  <version>3.3.4</version>
    <exclusions>
      <exclusion>
         <!-- use the jackson libraries specified by solr dependencies -->
         <groupId>com.fasterxml.jackson.core</groupId>
         <artifactId>jackson-core</artifactId>
      </exclusion>
    </exclusions>
</dependency>

With this approach there is no need to include specific versions of the jackson-core, jackson-databind, and jackson-annotations as the correct versions will be transitively included via the spark dependencies.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conflicts in spark-core dependencies. How does it work?
7 introduced dependencies conflict between jackson-databind itself. Where am I wrong in my reasoning?
Read more >
Win over Spark distribution's dependency conflicts with SBT ...
How SBT shade plugin can solve dependency conflicts between your jobs JAR and Spark distribution's Jars.
Read more >
[#BEAM-9239] Dependency conflict with Spark using aws io
Starting with beam 2.17.0 I get this error in the Spark 2.4.4 driver when aws io is also used: java.lang.
Read more >
Oozie job with spark2 action fails with Jackson ve... - 248490
Due to conflict in Jackson jar versions, Oozie job with spark2 action(spark action with spark2 sharelib) may get failed with below error:
Read more >
Maven dependency conflict resolution is annoying
one of the Spark libraries depends on jackson-databind version 2.6. · jackson-databind depends on jackson-core 2.6. · Some other dependency in my ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found