[英]ElasticSearch AbstractMethodError while making client
I am trying to make an elastic search transport client, but getting below error 我试图建立一个弹性搜索传输客户端,但低于错误
Caused by: java.lang.AbstractMethodError: org.elasticsearch.transport.TcpTransport.sendMessage(Ljava/lang/Object;Lorg/elasticsearch/common/bytes/BytesReference;Ljava/lang/Runnable;)V at org.elasticsearch.transport.TcpTransport.internalSendMessage(TcpTransport.java:1111) at org.elasticsearch.transport.TcpTransport.sendRequestToChannel(TcpTransport.java:1093) at org.elasticsearch.transport.TcpTransport.executeHandshake(TcpTransport.java:1600) 引起:java.lang.AbstractMethodError:org.elasticsearch.transport.TcpTransport.sendMessage(Ljava / lang / Object; Lorg / elasticsearch / common / bytes / BytesReference; Ljava / lang / Runnable;)V org.elasticsearch.transport。位于org.elasticsearch.transport.TcpTransport.sendRequestToChannel(TcpTransport.java:1093)的tcpTransport.internalSendMessage(TcpTransport.java:1111)org.elasticsearch.transport.TcpTransport.executeHandshake(TcpTransport.java:1600)
Here is my code : 这是我的代码:
Settings settings = Settings.builder()
.put("cluster.name", "elasticsearch")
.put("node.name", "node1").build();
TransportClient client = new PreBuiltTransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
Is this a dependency issue? 这是依赖性问题吗?
I got stuck on this. 我被困在这上面了。 You can't mix dependency versions. 您不能混合依赖版本。
Turned out I was using spring-data-elasticsearch
in one project that depended on another project that had the plain elasticsearch
dependency. 原来我在一个依赖于另一个具有普通elasticsearch
依赖关系的项目的项目中使用了spring-data-elasticsearch
。 These included differing versions and caused that error. 这些包括不同的版本并导致该错误。
That was not fun to track down. 追踪并不好玩。
It is a dependency issue. 这是一个依赖性问题。 In maven pom, i have below dependencies 在maven pom中,我有以下依赖关系
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>5.6.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.6.3</version>
</dependency>
I have removed the dependency of org.elasticsearch, and it is running fine. 我删除了org.elasticsearch的依赖项,它运行正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.