首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >方法不存在: org.elasticsearch.client.RequestOptions$Builder.setRequestConfig(Lorg/apache/http/client/config/RequestConfig;)

方法不存在: org.elasticsearch.client.RequestOptions$Builder.setRequestConfig(Lorg/apache/http/client/config/RequestConfig;)
EN

Stack Overflow用户
提问于 2022-05-31 09:52:32
回答 3查看 142关注 0票数 0

我正在使用SpringBoot2.3.4创建Hibernate Search 6应用程序

当我试图构建我的应用程序时,我面临着这个错误-

代码语言:javascript
复制
Description:

An attempt was made to call a method that does not exist. The attempt was made from the 
following location:

   org.hibernate.search.backend.elasticsearch.client.impl.ElasticsearchClientImpl.setPerRequestSocketTimeout(ElasticsearchClientImpl.java:198)

The following method did not exist:


org.elasticsearch.client.RequestOptions$Builder.setRequestConfig(Lorg/apache/http/client/config/RequestConfig;)Lorg/elasticsearch/client/RequestOptions$Builder;

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

jar:file:/C:/Users/pranali.rasal/.m2/repository/org/elasticsearch/client/elasticsearch-rest-client/7.6.2/elasticsearch-rest-client-7.6.2.jar!/org/elasticsearch/client/RequestOptions$Builder.class

The class hierarchy was loaded from the following locations:

org.elasticsearch.client.RequestOptions.Builder: 
file:/C:/Users/pranali.rasal/.m2/repository/org/elasticsearch/client/elasticsearch-rest-client/7.6.2/elasticsearch-rest-client-7.6.2.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.client.RequestOptions$Builder

下面是我添加的依赖项-

代码语言:javascript
复制
        <dependency>
            <groupId>org.hibernate.search</groupId>
            <artifactId>hibernate-search-mapper-orm</artifactId>
            <version>6.1.5.Final</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate.search</groupId>
            <artifactId>hibernate-search-backend-elasticsearch</artifactId>
            <version>6.1.5.Final</version>
        </dependency>

如果我漏掉了什么就告诉我。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2022-05-31 13:01:29

这里解释了所有这些:https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#gettingstarted-framework-spring-boot-dependency-versions

基本上,Spring正在管理您的依赖项,它正在强制使用较早版本的Elasticsearch客户端。您需要强制它回到Hibernate搜索期望的版本(更新的版本,7.16.x)。

澄清一下,这与我在其他答案中提到的Elasticsearch服务器版本无关。这完全是关于你的当事人的。

票数 1
EN

Stack Overflow用户

发布于 2022-05-31 10:08:25

这可能是由于elasticsearch依赖项的不兼容版本造成的。从https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#getting-started-compatibility,您似乎需要7.10或7.16,但您有7.6依赖。还检查服务器版本以确保。

票数 1
EN

Stack Overflow用户

发布于 2022-05-31 11:12:57

hibernate-搜索-后端-弹性搜索

在内部依赖于elasticsearch-rest-client-7.6.2.jar

和方法

org.elasticsearch.client.RequestOptions$Builder.setRequestConfig(Lorg/apache/http/client/config/RequestConfig;)Lorg/elasticsearch/client/RequestOptions$Builder;

它正试图在较低级别客户端的较晚版本中找到is。

临时解决方案是排除7.6.2,并包括最新版本的elasticsearch-rest-client-7.6.2.jar -

代码语言:javascript
复制
    <dependency>
        <groupId>org.hibernate.search</groupId>
        <artifactId>hibernate-search-backend-elasticsearch</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.elasticsearch.client</groupId>
                <artifactId>elasticsearch-rest-client</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

包括,

代码语言:javascript
复制
       <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client</artifactId>
            <version>7.10.0</version>
        </dependency>

由于这是暂时的,我不知道这是否可靠。如果有更好的解决办法,请告诉我。

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

https://stackoverflow.com/questions/72445687

复制
相关文章

相似问题

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