0

Not sure this problem is caused by Elasticsearch or Groovy Grape.

I have a groovy script that uses Grape to handle dependencies:

@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')
])

Netty transitive dependencies coming from 'org.elasticsearch.client.transport' are not correctly included and when I try to connect I get the following 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)

Running 'grape resolve org.elasticsearch.client transport 5.0.0' returns

/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

'org.elasticsearch.plugin:transport-netty4-client:5.0.0' dependencies are not resolved. I have also tried to explicitly include this dependency but it does not work. Any idea?

M. Justin
  • 14,487
  • 7
  • 91
  • 130
Fabrizio Fortino
  • 1,479
  • 1
  • 14
  • 22
  • Please see if this helps - http://stackoverflow.com/questions/32329891/vertx-noclassdeffounderror-io-netty-channel-eventloopgroup – Rao Oct 27 '16 at 12:11
  • Thanks @Rao but it's a different problem. I have also tried to declare the netty dependencies but it now complains about other missing classes. It's not a problem with netty but with the dependency system itself. – Fabrizio Fortino Oct 28 '16 at 09:02

0 Answers0