# Class file for org.elasticsearch.common.xcontent.ToXContentObject not found

**URL:** <https://discuss.elastic.co/t/class-file-for-org-elasticsearch-common-xcontent-toxcontentobject-not-found/226928>\
**Category:** Elasticsearch\
**Created:** [April 7, 2020, 3:10pm UTC](https://discuss.elastic.co/t/class-file-for-org-elasticsearch-common-xcontent-toxcontentobject-not-found/226928 "2020-04-07T15:10:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bengisu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bengisu/32/65840_2.png) [@Bengisu](https://discuss.elastic.co/u/Bengisu)\
**Post date:** [April 7, 2020, 3:10pm UTC](https://discuss.elastic.co/t/class-file-for-org-elasticsearch-common-xcontent-toxcontentobject-not-found/226928/1 "2020-04-07T15:10:10Z")

</div>

Hello,

I am trying to configure the Java High Level REST Client by using [https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.6/java-rest-high-getting-started-maven.html](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.6/java-rest-high-getting-started-maven.html) document.

I am using gradle as a dependency manager.  
I have added the followings to my configuration file :

'org.elasticsearch:elasticsearch:7.6.2'  
'org.elasticsearch.client:elasticsearch-rest-high-level-client:7.6.2',  
'org.elasticsearch.client:elasticsearch-rest-client:7.6.2'

But unfortunately, It cannot find many classes in elastic search library.

Example classes are for org.elasticsearch.common.xcontent.ToXContentObject and org.elasticsearch.common.unit.TimeValue. There are so many others as well.

Could you help me to find why this is happening? Do i need more dependencies?

Thanks  
Bengisu

---

<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:** [April 7, 2020, 3:22pm UTC](https://discuss.elastic.co/t/class-file-for-org-elasticsearch-common-xcontent-toxcontentobject-not-found/226928/2 "2020-04-07T15:22:41Z")

</div>

Welcome!

Are you using Spring Boot by any chance?

---

<div class="post-metadata">

**Author:** ![Bengisu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bengisu/32/65840_2.png) [@Bengisu](https://discuss.elastic.co/u/Bengisu)\
**Post date:** [April 7, 2020, 3:34pm UTC](https://discuss.elastic.co/t/class-file-for-org-elasticsearch-common-xcontent-toxcontentobject-not-found/226928/3 "2020-04-07T15:34:03Z")

</div>

Thank you!

No, I don't use Spring.

---

<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:** [April 7, 2020, 4:16pm UTC](https://discuss.elastic.co/t/class-file-for-org-elasticsearch-common-xcontent-toxcontentobject-not-found/226928/4 "2020-04-07T16:16:20Z")

</div>

For one of my projects, here the maven dependency tree I have:

```auto
[INFO] fr.pilato.elasticsearch.crawler:fscrawler-elasticsearch-client-v7:jar:2.7-SNAPSHOT
[INFO] +- fr.pilato.elasticsearch.crawler:fscrawler-elasticsearch-client-base:jar:2.7-SNAPSHOT:compile
[INFO] +- org.elasticsearch.client:elasticsearch-rest-high-level-client:jar:7.6.2:compile
[INFO] | +- org.elasticsearch:elasticsearch:jar:7.6.2:compile
[INFO] | | +- org.elasticsearch:elasticsearch-core:jar:7.6.2:compile
[INFO] | | +- org.elasticsearch:elasticsearch-secure-sm:jar:7.6.2:compile
[INFO] | | +- org.elasticsearch:elasticsearch-x-content:jar:7.6.2:compile
[INFO] | | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.8.11:compile
[INFO] | | | \- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.11:compile
[INFO] | | +- org.elasticsearch:elasticsearch-geo:jar:7.6.2:compile
[INFO] | | +- org.apache.lucene:lucene-core:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-analyzers-common:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-backward-codecs:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-grouping:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-highlighter:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-join:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-memory:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-misc:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-queries:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-queryparser:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-sandbox:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-spatial:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-spatial-extras:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-spatial3d:jar:8.4.0:compile
[INFO] | | +- org.apache.lucene:lucene-suggest:jar:8.4.0:compile
[INFO] | | +- org.elasticsearch:elasticsearch-cli:jar:7.6.2:compile
[INFO] | | | \- net.sf.jopt-simple:jopt-simple:jar:5.0.2:compile
[INFO] | | +- com.carrotsearch:hppc:jar:0.8.1:compile
[INFO] | | +- joda-time:joda-time:jar:2.10.4:compile
[INFO] | | +- com.tdunning:t-digest:jar:3.2:compile
[INFO] | | +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile
[INFO] | | +- org.apache.logging.log4j:log4j-api:jar:2.13.1:compile (optional) 
[INFO] | | \- org.elasticsearch:jna:jar:4.5.1:compile
[INFO] | +- org.elasticsearch.client:elasticsearch-rest-client:jar:7.6.2:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.5.12:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.4.13:compile
[INFO] | | +- org.apache.httpcomponents:httpasyncclient:jar:4.1.4:compile
[INFO] | | +- org.apache.httpcomponents:httpcore-nio:jar:4.4.13:compile
[INFO] | | +- commons-codec:commons-codec:jar:1.14:compile
[INFO] | | \- commons-logging:commons-logging:jar:1.2:compile
[INFO] | +- org.elasticsearch.plugin:mapper-extras-client:jar:7.6.2:compile
[INFO] | +- org.elasticsearch.plugin:parent-join-client:jar:7.6.2:compile
[INFO] | +- org.elasticsearch.plugin:aggs-matrix-stats-client:jar:7.6.2:compile
[INFO] | +- org.elasticsearch.plugin:rank-eval-client:jar:7.6.2:compile
[INFO] | \- org.elasticsearch.plugin:lang-mustache-client:jar:7.6.2:compile
[INFO] | \- com.github.spullara.mustache.java:compiler:jar:0.9.6:compile
[INFO] +- fr.pilato.elasticsearch.crawler:fscrawler-framework:jar:2.7-SNAPSHOT:compile
[INFO] | +- commons-io:commons-io:jar:2.6:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.10.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.10.3:compile
[INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.10.3:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.10.3:compile
[INFO] | | +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.10.3:compile
[INFO] | | | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile
[INFO] | | | \- jakarta.activation:jakarta.activation-api:jar:1.2.1:compile
[INFO] | | +- org.codehaus.woodstox:stax2-api:jar:4.2:compile
[INFO] | | \- com.fasterxml.woodstox:woodstox-core:jar:6.1.1:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.10.3:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.26:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.10.3:compile
[INFO] | +- org.apache.logging.log4j:log4j-core:jar:2.13.1:compile (optional) 
[INFO] | +- org.apache.logging.log4j:log4j-1.2-api:jar:2.13.1:compile (optional) 
[INFO] | +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.13.1:compile (optional) 
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.25:compile (optional) 
[INFO] | +- org.apache.logging.log4j:log4j-jcl:jar:2.13.1:compile (optional) 
[INFO] | +- org.apache.logging.log4j:log4j-jul:jar:2.13.1:compile (optional) 
[INFO] | \- org.fusesource.jansi:jansi:jar:1.18:compile (optional) 
[INFO] +- fr.pilato.elasticsearch.crawler:fscrawler-settings:jar:2.7-SNAPSHOT:compile

```

The class you're looking for is in `org.elasticsearch:elasticsearch-x-content:jar:7.6.2:compile`. Do you have it?

---

<div class="post-metadata">

**Author:** ![Bengisu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bengisu/32/65840_2.png) [@Bengisu](https://discuss.elastic.co/u/Bengisu)\
**Post date:** [April 8, 2020, 9:22am UTC](https://discuss.elastic.co/t/class-file-for-org-elasticsearch-common-xcontent-toxcontentobject-not-found/226928/5 "2020-04-08T09:22:05Z")

</div>

You're right. I don't have it.

I also needed to add all the transitive dependencies of elasticsearch.

This was useful, thank you!

---

<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:** [May 6, 2020, 9:22am UTC](https://discuss.elastic.co/t/class-file-for-org-elasticsearch-common-xcontent-toxcontentobject-not-found/226928/6 "2020-05-06T09:22:07Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
