# Port is already occupied when connecting to ElasticSearch with the help of Jolokia jvm agent

**URL:** <https://discuss.elastic.co/t/port-is-already-occupied-when-connecting-to-elasticsearch-with-the-help-of-jolokia-jvm-agent/127097>\
**Category:** Elasticsearch\
**Created:** [April 6, 2018, 1:18pm UTC](https://discuss.elastic.co/t/port-is-already-occupied-when-connecting-to-elasticsearch-with-the-help-of-jolokia-jvm-agent/127097 "2018-04-06T13:18:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikita\_Krasnov](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@Nikita\_Krasnov](https://discuss.elastic.co/u/Nikita_Krasnov)\
**Post date:** [April 6, 2018, 1:18pm UTC](https://discuss.elastic.co/t/port-is-already-occupied-when-connecting-to-elasticsearch-with-the-help-of-jolokia-jvm-agent/127097/1 "2018-04-06T13:18:06Z")

</div>

I want to monitor jvm health of Elasticsearch 6x with the help of jolokia java jvm agent 1.5.0. For taking all metrics from Jolokia I use Metricbeat-6.2.3 and then will put all of them to Elasticsearch. Everything is installed on Centos system.  
according to this instruction [https://jolokia.org/reference/html/agents.html#jvm-agent](https://jolokia.org/reference/html/agents.html#jvm-agent) I do such command:  
su -c "java -jar /tmp/jolokia-jvm-1.5.0-agent.jar --verbose --debug --port=10000 toggle org.elasticsearch.bootstrap.Elasticsearch" -s /bin/bash elasticsearch  
and get such notification  
Couldn't start agent for process matching "org.elasticsearch.bootstrap.Elasticsearch" (PID: 5166)  
Possible reason could be that port '10000' is already occupied.  
Please check the standard output of the target process for a detailed error message.  
And there is no effect when I change a port - still the same problem.

When I try to connect to Tomcat - everythings works fine and I get successful response on [http://127.0.0.1:8778/jolokia/](http://127.0.0.1:8778/jolokia/)  
What can be the problem of connection to Elastic?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 9, 2018, 8:18am UTC](https://discuss.elastic.co/t/port-is-already-occupied-when-connecting-to-elasticsearch-with-the-help-of-jolokia-jvm-agent/127097/2 "2018-04-09T08:18:49Z")

</div>

Can you share the output of the `java -jar` call over here plus any log files?

I assume that there is an issue with Elasticsearch using the Java Security Manager, so that jolokia might have problems to bind to a port, but this is just a guess for now, without further evidence.

--Alex

---

<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 7, 2018, 8:19am UTC](https://discuss.elastic.co/t/port-is-already-occupied-when-connecting-to-elasticsearch-with-the-help-of-jolokia-jvm-agent/127097/3 "2018-05-07T08:19:06Z")

</div>

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