我正在用gradle学习spring-boot-starter-data-elasticsearch。 我在下面的依赖关系定义在我.gradle文件:通过spring-boot-starter-data-elasticsearch查询Elasticsearch时出现异常
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'
}
我使用的2.3.1弹性搜索版本。 我通过扩展ElasticsearchRepository创建了一个类。 现在,当我尝试查询Elasticsearch我得到异常下面我
java.lang.NoSuchMethodError: com.fasterxml.jackson.dataformat.smile.SmileGenerator.getOutputContext()Lcom/fasterxml/jackson/core/json/JsonWriteContext;`
请帮我解决这个问题。
检查并验证您的类路径中只有一个版本的杰克逊依赖项。它看起来像是类加载器加载不兼容库的典型问题。 –