首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更正应用程序的类路径,使其包含单个兼容版本的org.elasticsearch.client.RestClientBuilder。

更正应用程序的类路径,使其包含单个兼容版本的org.elasticsearch.client.RestClientBuilder。
EN

Stack Overflow用户
提问于 2022-02-17 16:15:04
回答 1查看 372关注 0票数 0
代码语言:javascript
复制
An attempt was made to call a method that does not exist. The attempt was made from the following location:

   org.hibernate.search.elasticsearch.client.impl.DefaultElasticsearchClientFactory.createClient(DefaultElasticsearchClientFactory.java:92)

The following method did not exist:

    org.elasticsearch.client.RestClientBuilder.setMaxRetryTimeoutMillis(I)Lorg/elasticsearch/client/RestClientBuilder;

The method's class, org.elasticsearch.client.RestClientBuilder, is available from the following locations:

    jar:file:/home/temp/.gradle/caches/modules-2/files-2.1/org.elasticsearch.client/elasticsearch-rest-client/7.10.2/d0c857275bcec532079cdabb7913e2611c123e70/elasticsearch-rest-client-7.10.2.jar!/org/elasticsearch/client/RestClientBuilder.class

The class hierarchy was loaded from the following locations: 
 
    org.elasticsearch.client.RestClientBuilder: 
        file:/home/temp/.gradle/caches/modules-2/files-2.1/org.elasticsearch.client/elasticsearch-rest-client/7.10.2/d0c857275bcec532079cdabb7913e2611c123e70/elasticsearch-rest-client-7.10.2.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.client.RestClientBuilder* 

我们需要使用elasticsearch版本7.10.2,目前我们使用的是springboot版本2.3.9

有什么帮助吗?

这是application.yaml文件中弹性搜索7.10.2的正确映射吗?

代码语言:javascript
复制
 hibernate:
    format_sql: true
    search.default:
      elasticsearch:
        dynamic_mapping: true
        index_schema_management_strategy: update
        required_index_status: yellow

https://stackoverflow.com/users/6692043/yrodiere

EN

回答 1

Stack Overflow用户

发布于 2022-02-17 16:35:51

elasticsearch-rest-client依赖项( Elasticsearch的低级REST客户端)的版本不必与您实际使用的Elasticsearch服务器版本相匹配。elasticsearch-rest-client 7.16.3将很好地与Elasticsearch服务器7.10.2对话。如果你担心的话,elasticsearch-rest-client 7.16.3是在ASL2.0下授权的。

因此,简而言之:执行Hibernate搜索文档的建议,并升级到最新版本的elasticsearch-rest-client。请参见https://docs.jboss.org/hibernate/search/6.1/reference/en-US/html_single/#gettingstarted-framework-spring-boot-dependency-versions

Spring在您不知情的情况下自动设置依赖项的版本。虽然这通常是一件好事,但Spring依赖关系有时会有点过时。因此,建议至少对一些关键依赖项覆盖Spring的默认值。

使用Maven,将其添加到POM中:

5.6.5.Final 7.16.3

如果你使用Elasticsearch的高级REST客户端,现在.你在泡菜里。该客户端不再是开源的,并可能导致许可问题。而且它的最后一个开源版本(7.10)可能不适用于elasticsearch-rest-client 7.16.3。因此,如果您确实需要使用高级别REST客户端的7.10或更早版本,那么您将需要使用较早版本的elasticsearch-rest-client和Hibernate搜索。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71161670

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档