不确定此问题是由Elasticsearch还是Groovy Grape引起的。
我有一个使用Grape来处理依赖关系的groovy脚本:
@Grapes([
@Grab(group = 'org.elasticsearch', module = 'elasticsearch', version = '5.0.0'),
@Grab(group = 'org.elasticsearch.client', module = 'transport', version = '5.0.0'),
@Grab(group = 'org.apache.logging.log4j', module = 'log4j-api', version = '2.7'),
@Grab(group = 'org.apache.logging.log4j', module = 'log4j-core', version = '2.7')
])
来自' org.elasticsearch.client.transport'的Netty传递依赖关系没有正确包含,当我尝试连接时,我得到以下ClassNotFoundException
Caught: java.lang.NoClassDefFoundError: io/netty/channel/RecvByteBufAllocator
java.lang.NoClassDefFoundError: io/netty/channel/RecvByteBufAllocator
at org.elasticsearch.transport.Netty4Plugin.getSettings(Netty4Plugin.java:39)
at org.elasticsearch.plugins.PluginsService.lambda$getPluginSettings$0(PluginsService.java:85)
at org.elasticsearch.plugins.PluginsService.getPluginSettings(PluginsService.java:85)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:115)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:228)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:69)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:65)
运行&#39; grape解析org.elasticsearch.client transport 5.0.0 &#39;返回
/Users/user/.groovy/grapes/org.elasticsearch.client/transport/jars/transport-5.0.0.jar
/Users/user/.groovy/grapes/org.elasticsearch/elasticsearch/jars/elasticsearch-5.0.0.jar
/Users/user/.groovy/grapes/org.apache.lucene/lucene-core/jars/lucene-core-6.2.0.jar
/Users/user/.groovy/grapes/org.elasticsearch/securesm/jars/securesm-1.1.jar
/Users/user/.groovy/grapes/net.sf.jopt-simple/jopt-simple/jars/jopt-simple-5.0.2.jar
/Users/user/.groovy/grapes/com.carrotsearch/hppc/jars/hppc-0.7.1.jar
/Users/user/.groovy/grapes/joda-time/joda-time/jars/joda-time-2.9.4.jar
/Users/user/.groovy/grapes/org.joda/joda-convert/jars/joda-convert-1.2.jar
/Users/user/.groovy/grapes/org.yaml/snakeyaml/bundles/snakeyaml-1.15.jar
/Users/user/.groovy/grapes/com.fasterxml.jackson.core/jackson-core/bundles/jackson-core-2.8.1.jar
/Users/user/.groovy/grapes/com.tdunning/t-digest/jars/t-digest-3.0.jar
/Users/user/.groovy/grapes/org.hdrhistogram/HdrHistogram/bundles/HdrHistogram-2.1.6.jar
/Users/user/.groovy/grapes/net.java.dev.jna/jna/jars/jna-4.2.2.jar
/Users/user/.groovy/grapes/org.elasticsearch.plugin/transport-netty3-client/jars/transport-netty3-client-5.0.0.jar
/Users/user/.groovy/grapes/io.netty/netty/bundles/netty-3.10.6.Final.jar
/Users/user/.groovy/grapes/org.elasticsearch.plugin/transport-netty4-client/jars/transport-netty4-client-5.0.0.jar
/Users/user/.groovy/grapes/io.netty/netty-common/jars/netty-common-4.1.5.Final.jar
/Users/user/.groovy/grapes/org.elasticsearch.plugin/reindex-client/jars/reindex-client-5.0.0.jar
/Users/user/.groovy/grapes/org.elasticsearch.client/rest/jars/rest-5.0.0.jar
/Users/user/.groovy/grapes/org.apache.httpcomponents/httpcore/jars/httpcore-4.4.5.jar
/Users/user/.groovy/grapes/commons-codec/commons-codec/jars/commons-codec-1.10.jar
/Users/user/.groovy/grapes/commons-logging/commons-logging/jars/commons-logging-1.1.3.jar
/Users/user/.groovy/grapes/org.elasticsearch.plugin/lang-mustache-client/jars/lang-mustache-client-5.0.0.jar
/Users/user/.groovy/grapes/com.github.spullara.mustache.java/compiler/jars/compiler-0.9.3.jar
/Users/user/.groovy/grapes/org.elasticsearch.plugin/percolator-client/jars/percolator-client-5.0.0.jar
&#39; org.elasticsearch.plugin:传输netty4客户端:5.0.0 &#39;依赖关系未解决。我也试图明确包含这种依赖,但它不起作用。有什么想法吗?