0

I am learning spring-boot-starter-data-elasticsearch with gradle. I have defined below dependencies in my .gradle file:

dependencies {
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'org.springframework.boot:spring-boot-starter-data-elasticsearch:1.4.2.RELEASE'
compile 'org.springframework:spring-test:4.1.2.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-logging:1.4.2.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-web:1.4.2.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-actuator:1.4.2.RELEASE'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.6'
compile 'com.fasterxml.jackson.core:jackson-core:2.7.6'
testCompile 'junit:junit:4.12'
}

I am using Elastic search version of 2.3.1. I created one class by extending ElasticsearchRepository. Now when i try to query Elasticsearch i am getting below exception

java.lang.NoSuchMethodError: com.fasterxml.jackson.dataformat.smile.SmileGenerator.getOutputContext()Lcom/fasterxml/jackson/core/json/JsonWriteContext;`

Please help me to resolve this.

1
  • Check and validate that you only have one version of the jackson dependency on your classpath. It looks like a typical issue where the classloader loads an incompatible library. Commented Dec 21, 2016 at 8:49

1 Answer 1

1

This is a typical example where you're taking control of version dependencies yourself and you chose incompatible versions. Why are you doing this?

One of the strength of Spring Boot is that it provides a coherent and consistent dependency management. Rather than specifying the version yourself, you let a particular version of Spring Boot manages that for you. This works both with Maven and Gradle.

You can see what a typical gradle build file looks like by heading to https://start.spring.io, select Gradle project and type your dependencies in the search box (web, actuator, elasticsearch). Jackson is already provided by web and SLF4j comes with every starter.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.