# Java api elasticsearch node error

**URL:** <https://discuss.elastic.co/t/java-api-elasticsearch-node-error/35393>\
**Category:** Elasticsearch\
**Created:** [November 24, 2015, 8:21am UTC](https://discuss.elastic.co/t/java-api-elasticsearch-node-error/35393 "2015-11-24T08:21:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Isra](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Isra](https://discuss.elastic.co/u/Isra)\
**Post date:** [November 24, 2015, 8:21am UTC](https://discuss.elastic.co/t/java-api-elasticsearch-node-error/35393/1 "2015-11-24T08:21:55Z")

</div>

I'm using the JAVA API. I tried the following:

```
org.elasticsearch.node.Node node = nodeBuilder().node();
Client client = node.client();

```

and then the following:

```
Client client = TransportClient.builder().build() 
 .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9200));

```

But they both gave me the following error:

```
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap
at org.elasticsearch.client.transport.TransportClient$Builder.<init>(TransportClient.java:84)
at org.elasticsearch.client.transport.TransportClient.builder(TransportClient.java:76)
at tools.Tools.Searcher(Tools.java:195)
at tools.Tools.main(Tools.java:60)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 4 more
Java Result: 1

```

I am using Elasticsearch 2.0.0 and it is running on port `9200`

Help please? What is causing that error and how can I fix it?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 24, 2015, 8:42am UTC](https://discuss.elastic.co/t/java-api-elasticsearch-node-error/35393/2 "2015-11-24T08:42:07Z")

</div>

Missing dependencies probably

---

<div class="post-metadata">

**Author:** ![Isra](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Isra](https://discuss.elastic.co/u/Isra)\
**Post date:** [November 24, 2015, 8:56am UTC](https://discuss.elastic.co/t/java-api-elasticsearch-node-error/35393/3 "2015-11-24T08:56:07Z")

</div>

I'm using a Java application project in netbeans. Are you talking about this dependency?

```
<dependency>
   <groupId>org.elasticsearch</groupId>
   <artifactId>elasticsearch</artifactId>
   <version>${es.version}</version>
</dependency>

```

Where can I add this? I do not have a pom.xml file.

---

<div class="post-metadata">

**Author:** ![mainec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mainec/32/5557_2.png) [@mainec](https://discuss.elastic.co/u/mainec)\
**Post date:** [November 24, 2015, 12:10pm UTC](https://discuss.elastic.co/t/java-api-elasticsearch-node-error/35393/4 "2015-11-24T12:10:07Z")

</div>

> [@Isra](#):
>
> Java application project in netbeans

I think it's best to consult the netbeans community then.

> [@Isra](#):
>
> java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap

This reads like one of the few transitive dependencies Elasticsearch has is missing: [GitHub - google/guava: Google core libraries for Java](https://code.google.com/p/guava-libraries/) is the project that has the class.

Hope this helps,  
Isabel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:36pm UTC](https://discuss.elastic.co/t/java-api-elasticsearch-node-error/35393/5 "2017-07-05T23:36:19Z")

</div>


