方法不存在:org.elasticsearch.client.requestoptions $ builder.setRequestConfig(lorg/apache/http/client/client/config/requestconfig;)
我正在创建带有Spring Boot 2.3.4的Hibernate Search 6应用程序时,
我在尝试构建应用程序时面临此错误 -
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
以下是我添加的依赖项 -
<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>
让我知道是否缺少某些内容。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这一切都在此处解释: https://docs.jboss.org/hibernate/stable/search/reference/reference/en-us/html_single/#gettingstarted-framework-framework-spring-spring-boot-boot-boot-depperency-verned-versency-versions
基本上,Spring Boot是管理您的依赖关系,并且正在迫使Elasticsearch客户端的较旧版本。您需要将其强制回到Hibernate搜索期望版本(一个较新的版本,7.16.x)。
只是为了澄清,这与我在其他答案中提到的Elasticsearch Server版本无关。这严格来说是关于您的客户的。
This is all explained here: https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#gettingstarted-framework-spring-boot-dependency-versions
Basically, Spring Boot is managing your dependencies, and it's forcing an older version of the Elasticsearch client. You need to force it back to the version Hibernate Search expects (a newer version, 7.16.x).
And just to clarify, this has nothing to do with the Elasticsearch server version that I've seen mentioned in other answers. This is strictly about your client.
这可能是由于Elasticsearch依赖性不兼容的版本。来自看来您似乎需要7.10或7.16,但是您具有7.6依赖关系。还要检查服务器版本以确保。
This is probably due to incompatible version of the elasticsearch dependency. From https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#getting-started-compatibility it seems you need 7.10 or 7.16 but you have 7.6 dependency. Also check server version to be sure.
在内部取决于 elasticsearch-rest-client-7.6.2.jar
和该方法
它试图找到的是在低级客户端的以后版本中。
临时解决方案将排除7.6.2,并包含最新版本的 elasticsearch-rest-client-7.6.2.2.jar -
包括,
由于这是临时的,我不确定这是否可靠。
如果有更好的解决方案,请让我知道。
is internally dependent on elasticsearch-rest-client-7.6.2.jar
And the method
it is trying to find is in later versions of low level client.
Temporary solution will be to exclude 7.6.2 and include latest version of elasticsearch-rest-client-7.6.2.jar -
and including,
Since this is a temporary, I am not sure if this is reliable.
Please let me know in case there is a better solution.