# Elastic Search java.lang.ArrayIndexOutOfBoundsException at ToXContent on initialization of client

**URL:** <https://discuss.elastic.co/t/elastic-search-java-lang-arrayindexoutofboundsexception-at-toxcontent-on-initialization-of-client/104622>\
**Category:** Elasticsearch\
**Created:** [October 19, 2017, 9:12pm UTC](https://discuss.elastic.co/t/elastic-search-java-lang-arrayindexoutofboundsexception-at-toxcontent-on-initialization-of-client/104622 "2017-10-19T21:12:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![moneydance](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moneydance/32/23215_2.png) [@moneydance](https://discuss.elastic.co/u/moneydance)\
**Post date:** [October 19, 2017, 9:12pm UTC](https://discuss.elastic.co/t/elastic-search-java-lang-arrayindexoutofboundsexception-at-toxcontent-on-initialization-of-client/104622/1 "2017-10-19T21:12:32Z")

</div>

Stack Trace:

```
Caused by: java.lang.ExceptionInInitializerError
        at com.fmrco.sai.sod.common.elasticsearch.config.ElasticConfig.client(ElasticConfig.java:33) ~[ElasticConfig.class:?]
.............    
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
        at org.elasticsearch.common.xcontent.ToXContent.<clinit>(ToXContent.java:45) ~[elasticsearch-5.5.2.jar:5.5.2]

```

I am using elasticsearch version 5.5.2

here is the jar I am importing

```
<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>5.5.2</version><!--$NO-MVN-MAN-VER$ -->
</dependency>

```

This runs perfectly fine locally but breaks when I attempt to deploy the war on our server. Any ideas? I am running java 8 and tomcat 8 locally and on my server.

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [October 22, 2017, 8:10pm UTC](https://discuss.elastic.co/t/elastic-search-java-lang-arrayindexoutofboundsexception-at-toxcontent-on-initialization-of-client/104622/2 "2017-10-22T20:10:42Z")

</div>

It will help if you can provide the complete stacktrace of the exception and some code snippet of your client initialization.

---

<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:** [November 19, 2017, 8:10pm UTC](https://discuss.elastic.co/t/elastic-search-java-lang-arrayindexoutofboundsexception-at-toxcontent-on-initialization-of-client/104622/3 "2017-11-19T20:10:43Z")

</div>

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