Netty dependency issue with ElasticSearch 5.4

Hi,
I'm running ES 5.4.1 with the transport client library. I'm running into a dependency issue and below is the error:
(Netty4Utils:117)-NoSuchMethodError io.netty.buffer.CompositeByteBuf.addComponents(ZLjava/lang/Iterable;)Lio/netty/buffer/CompositeByteBuf;
at org.elasticsearch.transport.netty4.Netty4Utils.toByteBuf(Netty4Utils.java:78)
at org.elasticsearch.transport.netty4.Netty4Transport.sendMessage(Netty4Transport.java:422)
at org.elasticsearch.transport.netty4.Netty4Transport.sendMessage(Netty4Transport.java:93)
at org.elasticsearch.transport.TcpTransport.internalSendMessage(TcpTransport.java:1058)
at org.elasticsearch.transport.TcpTransport.sendRequestToChannel(TcpTransport.java:1040)

I did a mvn dependency tree and found the ES depends on both Netty3 and Netty4. I tried to exclude one but to no avail as ES needed the dependency. Does anyone know what's the way around it ?

Thanks !

1 Like

I had a similar problem and in my case, I used non-matched dependencies:

org.elasticsearch
elasticsearch
5.4.1


org.elasticsearch.client
transport
5.4.0

The fix was to use org.elasticsearch.client 5.4.1

I have the same versions of ES i.e. 5.4.1

I am running in the same issue. Can someone please help?

This is not a problem, Netty 3 and Netty 4 use completely different package names so there is no possibility of conflict.

Thanks for the response jason. Do you have any idea what else could cause that exception?

I think that you have an older version of Netty 4 on your classpath (maybe you accidentally included 4.0.11.Final or you have another dependency that depends on an older version of 4.0.x.Final of Netty? I say this because that method (io.netty.buffer.CompositeByteBuf io.netty.buffer.CompositeByteBuf#addComponents(boolean, java.lang.Iterable)) has existed through the life of the 4.1.x.Final series of Netty but not always in 4.0.x.Final. If you have an older 4.0.x.Final on the classpath then you can see exactly this error. Double check your dependencies and ensure that you have the right version and not a second version (explicitly or transitively).

These are all the netty jars in the classpath of my project.

find lib/ -iname "netty"
lib/netty-buffer-4.1.11.Final.jar
lib/netty-common-4.1.11.Final.jar
lib/netty-handler-4.1.11.Final.jar
lib/netty-codec-4.1.11.Final.jar
lib/netty-3.10.6.Final.jar
lib/netty-resolver-4.1.11.Final.jar
lib/transport-netty3-client-5.4.1.jar
lib/netty-codec-http-4.1.11.Final.jar
lib/transport-netty4-client-5.4.1.jar
lib/netty-transport-4.1.11.Final.jar

both versions were brought in by ElasticSearch itself. I don't have any explicit dependency on netty.

try setting

.put("transport.type","netty3")
.put("http.type", "netty3")

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.