ES 5 Transport : java.lang.NoSuchMethodError: io.netty.buffer.CompositeByteBuf.addComponents

Hi everyone,

After fixing the error with log4j as recommended here.

I have now the following error:

Exception in thread "main" java.lang.NoSuchMethodError: io.netty.buffer.CompositeByteBuf.addComponents(ZLjava/lang/Iterable;)Lio/netty/buffer/CompositeByteBuf;
        at org.elasticsearch.transport.netty4.Netty4Utils.toByteBuf(Netty4Utils.java:75)
        at org.elasticsearch.transport.netty4.Netty4Transport.sendMessage(Netty4Transport.java:449)
        at org.elasticsearch.transport.netty4.Netty4Transport.sendMessage(Netty4Transport.java:91)
        at org.elasticsearch.transport.TcpTransport.internalSendMessage(TcpTransport.java:947)
        at org.elasticsearch.transport.TcpTransport.sendRequest(TcpTransport.java:929)
        at org.elasticsearch.transport.TransportService.sendRequestInternal(TransportService.java:493)
        at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:459)
        at org.elasticsearch.transport.TransportService.submitRequest(TransportService.java:445)
        at org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler.doSample(TransportClientNodesService.java:388)
        at org.elasticsearch.client.transport.TransportClientNodesService$NodeSampler.sample(TransportClientNodesService.java:324)
        at org.elasticsearch.client.transport.TransportClientNodesService.addTransportAddresses(TransportClientNodesService.java:191)
        at org.elasticsearch.client.transport.TransportClient.addTransportAddress(TransportClient.java:282)
        at sonar.db.elasticsearch.ElasticSearchIndexCreator.createIndex(ElasticSearchIndexCreator.java:33)

Thank you.

Fixed. Problems was caused by others dependencies in my project.

Could you tell me how do you solve this problem?I have recently been learning the ES. AND I also met you meet problem

1 Like

Hey @wxx520,
This problem is caused by concurrent versions of Netty being used by different dependencies in your project.
Basically, ES 5 Transport API required Netty 4. And Dependency X, still use Netty 3. This can cause this problem.

What I tried:

  1. Add Netty 4 as dependecy in my project -> Didn't work.
  2. Create an independant project for my use of ES 5 Transport Client -> It worked.

My use of the Transport client was only to create an index and the mapping. Documents are stored with the elasticsearch spark connector.

I would advise you to try 1. And then if it does not work try 2.

1 Like

Hi,@Quent!
Thank you very much for your advice!The problem I encountered really was caused by a Netty version conflict.And I have solved it by trying 1.
My use of the Transport client is to play a role similar to the postman by java code .
And I has completed bulk index and update by Transport client. Next step is to the mapping.If i
My English is not very good.Nonetheless be glad to talk to you!

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