title: Error while Java client trying to connect to Elastic Search
body: <p>With below code am trying to connect and index to Elastic Search:</p>
  
  <pre><code>package elasticSearchTest;
  
  import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
  import java.net.InetAddress;
  import org.elasticsearch.action.index.IndexResponse;
  import org.elasticsearch.client.Client;
  import org.elasticsearch.client.transport.TransportClient;
  import org.elasticsearch.common.transport.InetSocketTransportAddress;
  import org.testng.annotations.Test;
  
  public class ES_Test_Class {
    @Test
    public void f() {
    try{
        Client client = TransportClient.builder().build()
                 .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
  
  
        IndexResponse response = client.prepareIndex("twitter", "tweet", "1")
                  .setSource(jsonBuilder()
                              .startObject()
                                  .field("user", "kimchy")
                                  .field("postDate", "18/May/2011:01:48:10")
                                  .field("message", "trying out Elasticsearch")
                              .endObject()
                            )
                  .get();
      // Document ID (generated or not)
        String _id = response.getId();
      // Version (if it's the first time you index this document, you will get: 1)
      long _version = response.getVersion();
  
      System.out.println("Document id is: "+_id);
  
      System.out.println("Document version is: "+_version);
        }
        catch (Exception e){
            e.printStackTrace();
        }
  
    }
  }
  </code></pre>
  
  <p>With below dependencies:</p>
  
  <ul>
  <li>List item</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/fzPdf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fzPdf.jpg" alt="enter image description here"></a></p>
  
  <p>However I keep getting below error:</p>
  
  <blockquote>
    <p>com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: org/jboss/netty/channel/socket/nio/WorkerPool
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
        at org.elasticsearch.common.inject.internal.FailableCache.get(FailableCache.java:51)
        at org.elasticsearch.common.inject.ConstructorInjectorStore.get(ConstructorInjectorStore.java:51)
        at org.elasticsearch.common.inject.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:50)
        at org.elasticsearch.common.inject.InjectorImpl.initializeBinding(InjectorImpl.java:405)
        at org.elasticsearch.common.inject.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:680)</p>
  </blockquote>
  
  <p>I have tried by changing the order of the JAR files and different versions of JARS lowering and changing to higher version by few of the suggestions as mentioned <a href="https://stackoverflow.com/questions/9222665/nosuchmethod-error-getting-a-gdata-service">here</a> but issue is not resolved</p>
  
  <p>Error after updating "netty" to "netty-4.0.0.Alpha8" and guava to "guava-20.0-hal":</p>
  
  <blockquote>
    <p>com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: org/jboss/netty/channel/ReceiveBufferSizePredictorFactory
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212)
        at com.google.common.cache.LocalCache.get(LocalCache.java:4054)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4058)
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4985)
        at org.elasticsearch.common.inject.internal.FailableCache.get(FailableCache.java:51)
        at org.elasticsearch.common.inject.ConstructorInjectorStore.get(ConstructorInjectorStore.java:51)</p>
  </blockquote>