简体   繁体   English

ElasticSearch AbstractMethodError在制作客户端时

[英]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.

相关问题 在Glassfish 3.1.2上使用WebService客户端代码部署耳朵时发生AbstractMethodError - AbstractMethodError while deploying an ear, with WebService client code, on Glassfish 3.1.2 与SmileFactory一起使用时的AbstractMethodError? - AbstractMethodError while using with SmileFactory? 创建JpaRepository时的AbstractMethodError - AbstractMethodError while creating JpaRepository 在Lucene中创建索引时发生AbstractMethodError - AbstractMethodError while creating an index in Lucene 启动点燃时发生java.lang.abstractmethoderror - java.lang.abstractmethoderror while Starting an Ignite REST 客户端子资源在调用时返回 AbstractMethodError - REST Client Sub-resources return AbstractMethodError when invoked 将Jersey客户端1.x升级到2.x时,UriBuilder上的AbstractMethodError - AbstractMethodError on UriBuilder when upgrading Jersey client 1.x to 2.x JAX RS Client:在进行REST调用时捕获异常消息 - JAX RS Client: Catch exception message while making a REST call 使用Jersey其余Web服务时出现java.lang.AbstractMethodError - java.lang.AbstractMethodError while using Jersey rest webservice 运行jersey项目时出现java.lang.AbstractMethodError - java.lang.AbstractMethodError while running jersey project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM