Upgrade to Elastic version 5.6.12 causes exception

Hello,

I'm trying to upgrade my ElasticSearch from 2.3.4 to 5.6.12. In order to create my Client, due to this upgrade, I use now the PreBuiltTransportClient instead of the TransportClient.

During the runtime I get the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: io.netty.util.internal.ObjectUtil.checkPositive(ILjava/lang/String;)I"}
io.netty.util.NettyRuntime$AvailableProcessorsHolder.setAvailableProcessors(NettyRuntime.java:44)"}
io.netty.util.NettyRuntime.setAvailableProcessors(NettyRuntime.java:87)"}
org.elasticsearch.transport.netty4.Netty4Utils.setAvailableProcessors(Netty4Utils.java:85)"}
org.elasticsearch.transport.netty4.Netty4Transport.(Netty4Transport.java:140)"}
org.elasticsearch.transport.Netty4Plugin.lambda$getTransports$0(Netty4Plugin.java:93)"}
org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:177)"}
org.elasticsearch.client.transport.TransportClient.(TransportClient.java:268)"}
org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:133)"}
org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:119)"}
org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:109)"}

I added in my pom.xml file the dependency for netty 4.1.13 which has the missing method but with no luck:

io.netty netty-all 4.1.13.Final

Could you please help me on this?

is it possible, that you still have an older netty version in your list of dependencies that gets loaded?

I added exlusion for netty in every depedency that gets loaded in my pom.xml file. This should be enough. Correct?
The problem was not fixed. I also added "System.setProperty("es.set.netty.runtime.available.processors", "false");" before I initialize my Client and now I get in the runtime the following exception:

:"Exception in thread "elasticsearch[client][management][T#1]" java.lang.NoSuchMethodError: io.netty.buffer.CompositeByteBuf.addComponents(ZLjava/lang/Iterable;)Lio/netty/buffer/CompositeByteBuf;"}

which netty version do you see when running mvn dependency:tree?

Please see below the result of the mvn dependency:tree:

[INFO] +- org.elasticsearch:elasticsearch:jar:5.6.12:compile
[INFO] | +- org.apache.lucene:lucene-core:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-analyzers-common:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-backward-codecs:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-grouping:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-highlighter:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-join:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-memory:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-misc:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-queries:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-queryparser:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-sandbox:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-spatial:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-spatial-extras:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-spatial3d:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-suggest:jar:6.6.1:compile
[INFO] | +- org.elasticsearch:securesm:jar:1.2:compile
[INFO] | +- net.sf.jopt-simple:jopt-simple:jar:5.0.2:compile
[INFO] | +- com.carrotsearch:hppc:jar:0.7.1:compile
[INFO] | +- joda-time:joda-time:jar:2.9.5:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.8.6:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.6:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.6:compile
[INFO] | +- com.tdunning:t-digest:jar:3.0:compile
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.11.1:compile
[INFO] | - org.elasticsearch:jna:jar:4.4.0-1:compile
[INFO] +- org.elasticsearch.client:transport:jar:5.6.12:compile
[INFO] | +- org.elasticsearch.plugin:transport-netty3-client:jar:5.6.12:compile
[INFO] | | +- org.locationtech.spatial4j:spatial4j:jar:0.6:compile
[INFO] | | +- com.vividsolutions:jts:jar:1.13:compile
[INFO] | | - org.apache.logging.log4j:log4j-core:jar:2.11.1:compile
[INFO] | +- org.elasticsearch.plugin:transport-netty4-client:jar:5.6.12:compile
[INFO] | | +- io.netty:netty-buffer:jar:4.1.13.Final:compile
[INFO] | | +- io.netty:netty-codec:jar:4.1.13.Final:compile
[INFO] | | +- io.netty:netty-codec-http:jar:4.1.13.Final:compile
[INFO] | | +- io.netty:netty-common:jar:4.1.13.Final:compile
[INFO] | | +- io.netty:netty-handler:jar:4.1.13.Final:compile
[INFO] | | +- io.netty:netty-resolver:jar:4.1.13.Final:compile
[INFO] | | - io.netty:netty-transport:jar:4.1.13.Final:compile
[INFO] | +- org.elasticsearch.plugin:reindex-client:jar:5.6.12:compile
[INFO] | | - org.elasticsearch.client:elasticsearch-rest-client:jar:5.6.12:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.4.5:compile
[INFO] | | +- org.apache.httpcomponents:httpasyncclient:jar:4.1.2:compile
[INFO] | | +- org.apache.httpcomponents:httpcore-nio:jar:4.4.5:compile
[INFO] | | - commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | +- org.elasticsearch.plugin:lang-mustache-client:jar:5.6.12:compile
[INFO] | | - com.github.spullara.mustache.java:compiler:jar:0.9.3:compile
[INFO] | +- org.elasticsearch.plugin:percolator-client:jar:5.6.12:compile
[INFO] | - org.elasticsearch.plugin:parent-join-client:jar:5.6.12:compile

I still get the following exception:

"Exception in thread "elasticsearch[client][management][T#1]" java.lang.NoSuchMethodError: io.netty.buffer.CompositeByteBuf.addComponents(ZLjava/lang/Iterable;)Lio/netty/buffer/CompositeByteBuf;"}
org.elasticsearch.transport.netty4.Netty4Utils.toByteBuf(Netty4Utils.java:120)"}
org.elasticsearch.transport.netty4.Netty4Transport.sendMessage(Netty4Transport.java:400)"}
org.elasticsearch.transport.netty4.Netty4Transport.sendMessage(Netty4Transport.java:96)"}
org.elasticsearch.transport.TcpTransport.internalSendMessage(TcpTransport.java:1138)"}
org.elasticsearch.transport.TcpTransport.sendRequestToChannel(TcpTransport.java:1124)"}
org.elasticsearch.transport.TcpTransport.executeHandshake(TcpTransport.java:1623)"}
org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:577)"}
org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:117)"}
org.elasticsearch.transport.TransportService.openConnection(TransportService.java:361)"}
org.elasticsearch.client.transport.TransportClientNodesService$SniffNodesSampler$1.doRun(TransportClientNodesService.java:506)"}
org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:675)"}
org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)"}
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)"}
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)"}

Thank you very much for the help.

there seem to be two transport client dependencies, one for netty3 and one for netty4

org.elasticsearch.plugin:transport-netty3-client

org.elasticsearch.plugin:transport-netty4-client

can you only use the netty4 one?

Thanks for the answer.

Could you please let me know how to do it?

The only thing I do regarding the transport client dependency is to add the following in the pom.xml file:

"< dependency>
< groupId>org.elasticsearch.client
< artifactId>transport
< version>5.6.12
< exclusions>

io.netty
netty-all
< /exclusion>
< /exclusions>
< /dependency>"

How can I exclude the netty3?

I have also found the folowing. Seems a similar issue:

I managed to remove org.elasticsearch.plugin:transport-netty3-client 9from mvn dependency:tree):

[INFO] +- org.elasticsearch:elasticsearch:jar:5.6.12:compile
[INFO] | +- org.apache.lucene:lucene-core:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-analyzers-common:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-backward-codecs:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-grouping:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-highlighter:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-join:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-memory:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-misc:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-queries:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-queryparser:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-sandbox:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-spatial:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-spatial-extras:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-spatial3d:jar:6.6.1:compile
[INFO] | +- org.apache.lucene:lucene-suggest:jar:6.6.1:compile
[INFO] | +- org.elasticsearch:securesm:jar:1.2:compile
[INFO] | +- net.sf.jopt-simple:jopt-simple:jar:5.0.2:compile
[INFO] | +- com.carrotsearch:hppc:jar:0.7.1:compile
[INFO] | +- joda-time:joda-time:jar:2.9.5:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.8.6:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.6:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.6:compile
[INFO] | +- com.tdunning:t-digest:jar:3.0:compile
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.11.1:compile
[INFO] | - org.elasticsearch:jna:jar:4.4.0-1:compile
[INFO] +- org.elasticsearch.client:transport:jar:5.6.12:compile
[INFO] | +- org.elasticsearch.plugin:transport-netty4-client:jar:5.6.12:compile
[INFO] | | +- io.netty:netty-buffer:jar:4.1.13.Final:compile
[INFO] | | +- io.netty:netty-codec:jar:4.1.13.Final:compile
[INFO] | | +- io.netty:netty-codec-http:jar:4.1.13.Final:compile
[INFO] | | +- io.netty:netty-common:jar:4.1.13.Final:compile
[INFO] | | +- io.netty:netty-handler:jar:4.1.13.Final:compile
[INFO] | | +- io.netty:netty-resolver:jar:4.1.13.Final:compile
[INFO] | | +- io.netty:netty-transport:jar:4.1.13.Final:compile
[INFO] | | +- org.locationtech.spatial4j:spatial4j:jar:0.6:compile
[INFO] | | +- com.vividsolutions:jts:jar:1.13:compile
[INFO] | | - org.apache.logging.log4j:log4j-core:jar:2.11.1:compile
[INFO] | +- org.elasticsearch.plugin:reindex-client:jar:5.6.12:compile
[INFO] | | - org.elasticsearch.client:elasticsearch-rest-client:jar:5.6.12:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.4.5:compile
[INFO] | | +- org.apache.httpcomponents:httpasyncclient:jar:4.1.2:compile
[INFO] | | +- org.apache.httpcomponents:httpcore-nio:jar:4.4.5:compile
[INFO] | | - commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | +- org.elasticsearch.plugin:lang-mustache-client:jar:5.6.12:compile
[INFO] | | - com.github.spullara.mustache.java:compiler:jar:0.9.3:compile
[INFO] | +- org.elasticsearch.plugin:percolator-client:jar:5.6.12:compile
[INFO] | - org.elasticsearch.plugin:parent-join-client:jar:5.6.12:compile
[INFO] +- io.netty:netty-all:jar:4.1.25.Final:compile

Now I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/transport/Netty3Plugin"}
org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:91)"}
com.nokia.ntas.api.es.ESActiveAlarmDB.createClient(ESActiveAlarmDB.java:105)"}
com.nokia.ntas.api.es.ESActiveAlarmDB.(ESActiveAlarmDB.java:72)"}
com.nokia.mme.ts.EventConsumer.main(EventConsumer.java:109)"}
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"}
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)"}
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"}
java.lang.reflect.Method.invoke(Method.java:498)"}
org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)"}
org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)"}
org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)"}
org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)"}
org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)"}
"Caused by: java.lang.ClassNotFoundException: org.elasticsearch.transport.Netty3Plugin"}
java.net.URLClassLoader.findClass(URLClassLoader.java:382)"}
java.lang.ClassLoader.loadClass(ClassLoader.java:424)"}
java.lang.ClassLoader.loadClass(ClassLoader.java:357)"}

Btw I have added in my pom.xml the following dependency with no result:

< dependency>
< groupId>org.elasticsearch.plugin
transport-netty4-client
< version>${elastic.version}
< /dependency>

Hi Alex,

Could you please help me with this?

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