我正在用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;`
請幫我解決這個問題。
檢查並驗證您的類路徑中只有一個版本的傑克遜依賴項。它看起來像是類加載器加載不兼容庫的典型問題。 –