# Elastic search and tomcat integration thread issue

**URL:** https://discuss.elastic.co/t/elastic-search-and-tomcat-integration-thread-issue/11913
**Category:** Elasticsearch
**Created:** [May 10, 2013, 11:33am UTC](https://discuss.elastic.co/t/elastic-search-and-tomcat-integration-thread-issue/11913 "2013-05-10T11:33:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Chetana](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Chetana](https://discuss.elastic.co/u/Chetana)
#### Post date: [May 10, 2013, 11:33am UTC](https://discuss.elastic.co/t/elastic-search-and-tomcat-integration-thread-issue/11913/1 "2013-05-10T11:33:39Z")

</div>

I need some help and it is urgent...

I have created a war which invokes index and search on elasticsearch and deployed in Tomcat 6.x. But I am keep getting

"org.apache.catalina.loader.WebappClassLoader clearReferencesThreads  
SEVERE: The web application [/test] appears to have started a thread named [elasticsearch[sample][riverClusterService#updateTask][T#1]] but has failed to stop it. This is very likely to create a memory leak."

and sometimes  
"The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.  
java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)"

All http requests are passed through a servlet in the war where I do some transformations after that it invokes TransportClient and uses IndexRequest, UpdateRequest etc. available under org.elasticsearch.action to perform add/update etc.

In my elastic search configuration I have

# Search pool

threadpool.search.type: fixed  
threadpool.search.size: 40  
threadpool.search.queue\_size: 200

# Bulk pool

threadpool.bulk.type: fixed  
threadpool.bulk.size: 20  
threadpool.bulk.queue\_size: 100

# Index pool

threadpool.index.type: fixed  
threadpool.index.size: 30  
threadpool.index.queue\_size: 100

Is my configuration right?

To avoid thread leaking, I could think of two solutions

1. I am suspecting threads created by elasticsearch which are not under Tomcat control are causing the error. Is there a way elastic search using threads from the pool maintained by Tomcat. If so, what to be configured

2. I dont want to expose it as a Restful service using RestSearchAction provided by elasticsearch. Is there other options like writing a plugin or registering my servlet in elasticsearch server so that client can invoke the url and do the indexing and I do the necessary transformations either inside plugin or servlet and remove war and also Tomcat

Thanks

---

<div class="post-metadata">

### Author: ![Arun\_Sankar](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@Arun\_Sankar](https://discuss.elastic.co/u/Arun_Sankar)
#### Post date: [May 23, 2013, 11:57pm UTC](https://discuss.elastic.co/t/elastic-search-and-tomcat-integration-thread-issue/11913/2 "2013-05-23T23:57:39Z")

</div>

Hello,

Sadly I am also facing the same problem.  
Please let me know whether you managed to solve the problem.

Arun

---

<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 6, 2017, 2:35am UTC](https://discuss.elastic.co/t/elastic-search-and-tomcat-integration-thread-issue/11913/3 "2017-07-06T02:35:00Z")

</div>


