# ElasticSearch SearchRequestBuilder java.lang.NoClassDefFoundError: com.fasterxml.jackson.core.JsonGenerator

**URL:** <https://discuss.elastic.co/t/elasticsearch-searchrequestbuilder-java-lang-noclassdeffounderror-com-fasterxml-jackson-core-jsongenerator/41101>\
**Category:** Elasticsearch\
**Created:** [February 5, 2016, 9:20pm UTC](https://discuss.elastic.co/t/elasticsearch-searchrequestbuilder-java-lang-noclassdeffounderror-com-fasterxml-jackson-core-jsongenerator/41101 "2016-02-05T21:20:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raaj\_mndl](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@raaj\_mndl](https://discuss.elastic.co/u/raaj_mndl)\
**Post date:** [February 5, 2016, 9:20pm UTC](https://discuss.elastic.co/t/elasticsearch-searchrequestbuilder-java-lang-noclassdeffounderror-com-fasterxml-jackson-core-jsongenerator/41101/1 "2016-02-05T21:20:15Z")

</div>

I am using ElasticSearch 2.1.1 version. Using a java client I am trying to execute a search request.

```
SearchResponse searchResp = 
client.prepareSearch(index)
.setTypes(type)
.setQuery(QueryBuilders.matchQuery("field", "value"))
.setFetchSource(new String[]{"selected"}, null)
.execute()
.actionGet();

```

I am using Jackson as my JSON library. here are my pom.xml entries

```
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.6.0</version>
<scope>provided</scope>
    </dependency>

    <dependency>
    <groupId>com.fasterxml.jackson.jaxrs</groupId>
    <artifactId>jackson-jaxrs-xml-provider</artifactId>
    <version>2.6.0</version>
    <scope>provided</scope>
    </dependency>

    <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.6.0</version>
    </dependency>

    <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.6.0</version>
    <scope>provided</scope>
</dependency>

     <dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>2.1.1</version>
    <scope>provided</scope>
     </dependency>

```

I have deployed the application is Websphere Application Server, and have included the Jackson libraries in a sharedlib(isolated classloader)

the above code is throwing the exception

```
com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[UserGroupsManagementApplication]: **java.lang.NoClassDefFoundError: com.fasterxml.jackson.core.JsonGenerator**
    at java.lang.J9VMInternals.verifyImpl(Native Method)
    at java.lang.J9VMInternals.verify(J9VMInternals.java:94)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:169)
    at org.elasticsearch.common.xcontent.XContentFactory.contentBuilder(XContentFactory.java:124)
    at org.elasticsearch.action.support.ToXContentToBytes.buildAsBytes(ToXContentToBytes.java:62)
    at org.elasticsearch.action.search.SearchRequest.source(SearchRequest.java:250)
    at org.elasticsearch.action.search.SearchRequestBuilder.beforeExecute(SearchRequestBuilder.java:1019)
    at org.elasticsearch.action.search.SearchRequestBuilder.beforeExecute(SearchRequestBuilder.java:50)
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85)
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:59)

```

By doing a type search in eclipse for JSONGenerator, I can see that this class is also available in jackson-core-asl-1.9.2.jar (codehaus package). This dependency is being automatically added by maven.

I am not sure if this is a conflict issue. Please help.

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [February 6, 2016, 3:43pm UTC](https://discuss.elastic.co/t/elasticsearch-searchrequestbuilder-java-lang-noclassdeffounderror-com-fasterxml-jackson-core-jsongenerator/41101/2 "2016-02-06T15:43:33Z")

</div>

> [@raaj\_mndl](#):
>
> I am not sure if this is a conflict issue. Please help.

Yes, it's almost surely a JAR hell issue that you'll need to resolve. A `NoClassDefFoundError` usually has a root cause that will give you more insight into the exact problem here (I would guess it's a class initialization failure) but either way you're going to have get around the JAR hell.

---

<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:18pm UTC](https://discuss.elastic.co/t/elasticsearch-searchrequestbuilder-java-lang-noclassdeffounderror-com-fasterxml-jackson-core-jsongenerator/41101/3 "2017-07-05T23:18:24Z")

</div>


