连接本地环境时,ElasticSearch无法获取TransPortClient [英] ElasticSearch can't get the TransPortClient when connect the local env

查看:1409
本文介绍了连接本地环境时,ElasticSearch无法获取TransPortClient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用TransPortClient方法创建ElasticSearch客户端。
代码如下:

When i use the TransPortClient method to create the ElasticSearch client. The code is like this :

public static void main(String[] args) {

    // ES config
    Settings settings = settingsBuilder()
            .put("cluster.name", "dev-application")
            .put("client.transport.sniff", true)
            .build();
    // ES client
    try {
        TransportClient client = TransportClient.builder().settings(settings).build()
                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));
    } catch (Exception e) {
        System.out.println("print");
        e.printStackTrace();
    }
    System.out.println("print");
}

但是我收到以下错误信息:

But i get the error info show below:

01:32:09.288 [main] DEBUG org.elasticsearch.client.transport - [Magilla] node_sampler_interval[5s]
Disconnected from the target VM, address: '127.0.0.1:54569', transport: 'socket'
Exception in thread "main" java.lang.VerifyError: (
  class: org/jboss/netty/channel/socket/nio/NioWorkerPool, 
  method: newWorker signature(Ljava/util/concurrent/Executor;)Lorg/jboss/netty/channel/socket/nio/AbstractNioWorker;) 
  Wrong return type in function
    at org.elasticsearch.transport.netty.NettyTransport.createClientBootstrap(NettyTransport.java:349)
    at org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:277)
    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
    at org.elasticsearch.transport.TransportService.doStart(TransportService.java:170)
    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
    at org.elasticsearch.client.transport.TransportClient$Builder.build(TransportClient.java:159)
    at com.dmall.dms.fastdelivery.service.parser.SimpleParserServiceTest.main(SimpleParserServiceTest.java:26)

我不明白这是怎么发生的,有人能遇到这个问题吗?谢谢!!!

i can't understand how this happen, can someone ever meet this problem?? thanks!!!

推荐答案

你似乎与两个不同的JAR,JBoss和Elasticsearch的Netty类有依赖冲突。

You seem to have a dependency conflict with Netty classes coming from two different JARs, JBoss ones and Elasticsearch ones.

如果是这样,你需要排除JBoss之一,即org.jboss.nettypackage,你应该是好的。

if that's the case, you need to exclude the JBoss one, i.e. org.jboss.nettypackage and you should be good.

这篇关于连接本地环境时,ElasticSearch无法获取TransPortClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆