我正在尝试连接到这样的弹性搜索,
Transport client = new PreBuiltTransportClient(Settings.EMPTY).
addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9200));
但是当我跑步时,我得到以下错误: –
Exception in thread "main" java.lang.AbstractMethodError: io.netty.util.concurrent.MultithreadEventExecutorGroup.newChild(Ljava/util/concurrent/Executor;[Ljava/lang/Object;)Lio/netty/util/concurrent/EventExecutor;
at io.netty.util.concurrent.MultithreadEventExecutorGroup.(MultithreadEventExecutorGroup.java:84)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.(MultithreadEventExecutorGroup.java:58)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.(MultithreadEventExecutorGroup.java:47)
at io.netty.channel.MultithreadEventLoopGroup.(MultithreadEventLoopGroup.java:49)
我的pom.xml是
org.elasticsearch.client
transport
5.2.1
org.apache.logging.log4j
log4j-core
2.6.2
请提前帮助谢谢
解决方法:
我猜这可能是因为在将弹性搜索版本从低于2.4的版本升级到当前版本时,您的实现发生了变化.
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9200));
虽然在Version 2.3之前和之前的实施如下:
Client client = TransportClient.builder().build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host1"), 9300))
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host2"), 9300));
Thrown when an application tries to call an abstract method. Normally,
this error is caught by the compiler; this error can only occur at run
time if the definition of some class has incompatibly changed since
the currently executing method was last compiled.
我也建议你,通过mvn依赖:树并排除工件org.elasticsearch.client的任何其他依赖项.
标签:java,elasticsearch
来源: https://codeday.me/bug/20190623/1265828.html