# Instantiate Elasticsearch server within a Tomcat process

**URL:** <https://discuss.elastic.co/t/instantiate-elasticsearch-server-within-a-tomcat-process/99720>\
**Category:** Elasticsearch\
**Created:** [September 7, 2017, 12:26pm UTC](https://discuss.elastic.co/t/instantiate-elasticsearch-server-within-a-tomcat-process/99720 "2017-09-07T12:26:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sambit\_Kabi](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Sambit\_Kabi](https://discuss.elastic.co/u/Sambit_Kabi)\
**Post date:** [September 7, 2017, 12:26pm UTC](https://discuss.elastic.co/t/instantiate-elasticsearch-server-within-a-tomcat-process/99720/1 "2017-09-07T12:26:20Z")

</div>

Hello ,

I have to instantiate ES within a Tomcat process. Normally ES is instantiated as a separate process and clients connect to it.  
What I would like to do is to instantiate the ES within a Tomcat and connect to it using a client. How do I tell the Tomcat to instantiate Elasticsearch class so that the ES gets started when the Tomcat instance is up.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [September 7, 2017, 12:34pm UTC](https://discuss.elastic.co/t/instantiate-elasticsearch-server-within-a-tomcat-process/99720/2 "2017-09-07T12:34:07Z")

</div>

Embedding Elasticsearch is no longer supported, as outlined [in this blog post](https://www.elastic.co/blog/elasticsearch-the-server).

---

<div class="post-metadata">

**Author:** ![Sambit\_Kabi](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Sambit\_Kabi](https://discuss.elastic.co/u/Sambit_Kabi)\
**Post date:** [September 7, 2017, 1:27pm UTC](https://discuss.elastic.co/t/instantiate-elasticsearch-server-within-a-tomcat-process/99720/3 "2017-09-07T13:27:29Z")

</div>

Thanks Christian for directing me to this post.  
Just out of curiosity what if I call the main method of Elasticsearch class using reflection and start it?  
I know this is not a good idea but will there be any repercussion in such a case?

---

<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:** [October 5, 2017, 1:27pm UTC](https://discuss.elastic.co/t/instantiate-elasticsearch-server-within-a-tomcat-process/99720/4 "2017-10-05T13:27:54Z")

</div>

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