# Elasticsearch 2.0 NoClassDefFoundError for JsonXContentGenerator

**URL:** <https://discuss.elastic.co/t/elasticsearch-2-0-noclassdeffounderror-for-jsonxcontentgenerator/34251>\
**Category:** Elasticsearch\
**Created:** [November 10, 2015, 2:26pm UTC](https://discuss.elastic.co/t/elasticsearch-2-0-noclassdeffounderror-for-jsonxcontentgenerator/34251 "2015-11-10T14:26:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkstsph](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@mkstsph](https://discuss.elastic.co/u/mkstsph)\
**Post date:** [November 10, 2015, 2:26pm UTC](https://discuss.elastic.co/t/elasticsearch-2-0-noclassdeffounderror-for-jsonxcontentgenerator/34251/1 "2015-11-10T14:26:23Z")

</div>

Hello, I am trying to update my elasticsearch java client api version from 1.4.2 to 2.0.0. But when I use:

```
XContentBuilder builder = XContentFactory.jsonBuilder()

```

It used to work in 1.4.2 but I get this exception in 2.0.0:

```
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.common.xcontent.json.JsonXContentGenerator
at org.elasticsearch.common.xcontent.json.JsonXContent.newXContentGenerator(JsonXContent.java:69) ~[elasticsearch-2.0.0.jar:2.0.0]
at org.elasticsearch.common.xcontent.json.JsonXContent.createGenerator(JsonXContent.java:74) ~[elasticsearch-2.0.0.jar:2.0.0]
at org.elasticsearch.common.xcontent.json.JsonXContent.createGenerator(JsonXContent.java:80) ~[elasticsearch-2.0.0.jar:2.0.0]
at org.elasticsearch.common.xcontent.XContentBuilder.<init>(XContentBuilder.java:112) ~[elasticsearch-2.0.0.jar:2.0.0]
at org.elasticsearch.common.xcontent.XContentBuilder.<init>(XContentBuilder.java:102) ~[elasticsearch-2.0.0.jar:2.0.0]
at org.elasticsearch.common.xcontent.XContentBuilder.builder(XContentBuilder.java:80) ~[elasticsearch-2.0.0.jar:2.0.0]
at org.elasticsearch.common.xcontent.json.JsonXContent.contentBuilder(JsonXContent.java:40) ~[elasticsearch-2.0.0.jar:2.0.0]
at org.elasticsearch.common.xcontent.XContentFactory.contentBuilder(XContentFactory.java:122) ~[elasticsearch-2.0.0.jar:2.0.0]
at org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder(XContentFactory.java:49) ~[elasticsearch-2.0.0.jar:2.0.0]

```

In pom.xml:

```
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>2.0.0</version>
        </dependency>

```

Thank you

---

<div class="post-metadata">

**Author:** ![Ramdev\_Wudali](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramdev_wudali/32/7894_2.png) [@Ramdev\_Wudali](https://discuss.elastic.co/u/Ramdev_Wudali)\
**Post date:** [March 9, 2016, 10:51pm UTC](https://discuss.elastic.co/t/elasticsearch-2-0-noclassdeffounderror-for-jsonxcontentgenerator/34251/2 "2016-03-09T22:51:21Z")

</div>

check this solution out :

> <https://stackoverflow.com/questions/33668694/elasticsearch-2-0-noclassdeffounderror-for-jsonxcontentgenerator>

---

<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:09pm UTC](https://discuss.elastic.co/t/elasticsearch-2-0-noclassdeffounderror-for-jsonxcontentgenerator/34251/3 "2017-07-05T23:09:45Z")

</div>


