gpt4 book ai didi

elasticsearch - 在 Elasticsearch 6 上找不到 org.elasticsearch.common.transport.InetSocketTransportAddress

转载 作者:行者123 更新时间:2023-11-29 02:43:50 24 4
gpt4 key购买 nike

我的代码在 elasticsearch 5 中运行良好,但是当我从 5 升级到 6 时。它正在显示

org.elasticsearch.common.transport.InetSocketTransportAddress not found

完整的堆栈跟踪:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project elastic-store: Compilation failure
[ERROR] /home/elastic/elastic-store/src/main/java/com/qw/psence/store/es/common/ESClient.java:[12,42] cannot find symbol
[ERROR] symbol: class InetSocketTransportAddress
[ERROR] location: package org.elasticsearch.common.transport
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]

谁能帮我解决这个问题?

注意:Elaticsearch jar 没问题。

最佳答案

Elastic search 6.0 移除了 InetSocketTransportAddress 类。我已经通过用 TransportAddress 类替换 InetSocketTransportAddress 类来解决这个问题。

// on startup

TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new TransportAddress(InetAddress.getByName("host1"), 9300))
.addTransportAddress(new TransportAddress(InetAddress.getByName("host2"), 9300));

// on shutdown

client.close();

关于elasticsearch - 在 Elasticsearch 6 上找不到 org.elasticsearch.common.transport.InetSocketTransportAddress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50986095/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com