My project was using a very old version of elasticsearch (1.7.1). I am trying to upgrade it to 6.4.0
Following are the jars I added newly.
elasticsearch-6.4.0.jar
elasticsearch-core-6.4.0.jar
elasticsearch-x-content-6.4.0.jar
transport-6.4.0.jar
transport-netty4-client-6.4.0.jar
log4j-api-2.11.0.jar
log4j-core-2.11.0.jar
lucene-core-7.4.0.jar
reindex-client-6.4.0.jar
percolator-client-6.4.0.jar
lang-mustache-client-6.4.0.jar
parent-join-client-6.4.0.jar
rank-eval-client-6.4.0.jar
hppc-0.8.1.jar
During my tomcat start I am getting this exception
java.lang.NoClassDefFoundError: io/netty/util/internal/logging/InternalLoggerFactory
at org.elasticsearch.transport.Netty4Plugin.(Netty4Plugin.java:48)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:602)
at org.elasticsearch.plugins.PluginsService.(PluginsService.java:112)
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:108)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:133)
at org.elasticsearch.client.transport.TransportClient.(TransportClient.java:283)
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:128)
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:114)
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:104)
at com.virima.indexing.IndexUtils.initializeESConnection(IndexUtils.java:61)
And my initilization code is as below
Settings settings = Settings.builder()
.put("cluster.name", "myClusterName").build();
TransportClient client = new PreBuiltTransportClient(settings)
.addTransportAddress(new TransportAddress(InetAddress.getByName("host1"), 9300))
.addTransportAddress(new TransportAddress(InetAddress.getByName("host2"), 9300));