# Trouble configuring agent server

**URL:** <https://discuss.elastic.co/t/trouble-configuring-agent-server/197970>\
**Category:** APM\
**Tags:** java\
**Created:** [September 4, 2019, 3:32am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970 "2019-09-04T03:32:45Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![skyluke.1987](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@skyluke.1987](https://discuss.elastic.co/u/skyluke.1987)\
**Post date:** [September 4, 2019, 3:32am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/1 "2019-09-04T03:32:45Z")

</div>

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text 🙂

**Kibana version** : 7.1.1

**Elasticsearch version** : 7.1.1

**APM Server version** : 1.x current

**APM Agent language and version** : English

**Browser version** : Chrome

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: java -javaagent:/path/to/elastic-apm-agent-.jar   
-Delastic.apm.service\_name=my-application   
-Delastic.apm.server\_url=http://localhost:8200   
-Delastic.apm.secret\_token=   
-Delastic.apm.application\_packages=org.example   
-jar my-application.jar

**Fresh install or upgraded from other version?** Fresh

**Is there anything special in your setup?** For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.  
Unable to execute the "java -javaagent" command and can't find the file.

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/1/a1e9e9aacb172acf70b136316b33f921dcb66225.png)

Problem with : "Start the application with the javaagent flag"

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [September 4, 2019, 3:56am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/2 "2019-09-04T03:56:28Z")

</div>

You are using the wrong jar. You need to use the `elastic-apm-agent-1.9.0.jar`.  
See [related documentation](https://www.elastic.co/guide/en/apm/agent/java/current/setup-javaagent.html).

---

<div class="post-metadata">

**Author:** ![skyluke.1987](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@skyluke.1987](https://discuss.elastic.co/u/skyluke.1987)\
**Post date:** [September 4, 2019, 3:58am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/3 "2019-09-04T03:58:42Z")

</div>

java -javaagent:"/etc/apm-agent/elastic-apm-agent-1.9.0.jar" -Delastic.apm.service\_name=apm-agent1 -Delastic.apm.server\_url=http://10.0.0.0:8200 -Delastic.apm.secret\_token= -Delastic.apm.application\_packages=https://site.com.sg -jar elastic-apm-agent-1.9.0.jar

Is this correct? But it still showing "Error: Invalid or corrupt jarfile elastic-apm-agent-1.9.0.jar"

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [September 4, 2019, 5:40am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/4 "2019-09-04T05:40:19Z")

</div>

> [@skyluke.1987](#):
>
> java -javaagent:"/etc/apm-agent/elastic-apm-agent-1.9.0.jar" -Delastic.apm.service\_name=apm-agent1 -Delastic.apm.server\_url=[http://10.0.0.0:8200](http://10.0.0.0:8200) -Delastic.apm.secret\_token= -Delastic.apm.application\_packages=[https://site.com.sg](https://site.com.sg) -jar elastic-apm-agent-1.9.0.jar

That part `-jar elastic-apm-agent-1.9.0.jar`  
Should be your app jar not the agent jar

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [September 4, 2019, 5:41am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/5 "2019-09-04T05:41:28Z")

</div>

Ohh, I just noticed your command is trying to install our java agent on the java agent attaching process...  
You really mixed up things.  
Please take a close look at the setup documentation.  
You either install an agent using the `javaagent` option, or using the attach, not both

---

<div class="post-metadata">

**Author:** ![skyluke.1987](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@skyluke.1987](https://discuss.elastic.co/u/skyluke.1987)\
**Post date:** [September 4, 2019, 6:29am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/6 "2019-09-04T06:29:52Z")

</div>

Hi thanks for explaining. May I know this is to monitor and capture the Java application data?

What if the server only has Nginx, do we still install this Java agent on this server? Sorry I am new on this and unsure of the process.

---

<div class="post-metadata">

**Author:** ![skyluke.1987](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@skyluke.1987](https://discuss.elastic.co/u/skyluke.1987)\
**Post date:** [September 4, 2019, 6:31am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/7 "2019-09-04T06:31:11Z")

</div>

Hi could you share with me where can I get a clearer explanation on this? I am quite confused with the elastic documentation. Thanks

I am doing this is to get the APM to work on my Ubuntu and Linux server.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [September 4, 2019, 6:57am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/8 "2019-09-04T06:57:32Z")

</div>

I currently don't know of any other resource we have other than [the setup documentation](https://www.elastic.co/guide/en/apm/agent/java/current/setup.html).  
Normally, this is what users read when starting. Please be more specific in what is not clear enough.

---

<div class="post-metadata">

**Author:** ![skyluke.1987](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@skyluke.1987](https://discuss.elastic.co/u/skyluke.1987)\
**Post date:** [September 4, 2019, 7:00am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/9 "2019-09-04T07:00:48Z")

</div>

Previously I was thinking to use the "Automatic setup" method to setup the agent, so to follow the original configuration and setting, that is why I choose this version of .jar file. [https://www.elastic.co/guide/en/apm/agent/java/current/setup-attach-cli.html](https://www.elastic.co/guide/en/apm/agent/java/current/setup-attach-cli.html) ........ Am I correct to say that?

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [September 4, 2019, 7:01am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/10 "2019-09-04T07:01:25Z")

</div>

> [@skyluke.1987](#):
>
> May I know this is to monitor and capture the Java application data?

Yes, the Java agent is only for capturing Java application data. It cannot monitor NginX. There are other components to collect [logs](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-nginx.html) and [metrics](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-nginx.html) data for NginX.

---

<div class="post-metadata">

**Author:** ![skyluke.1987](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@skyluke.1987](https://discuss.elastic.co/u/skyluke.1987)\
**Post date:** [September 4, 2019, 8:29am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/11 "2019-09-04T08:29:01Z")

</div>

Sorry, may i know what are those?

---

<div class="post-metadata">

**Author:** ![skyluke.1987](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@skyluke.1987](https://discuss.elastic.co/u/skyluke.1987)\
**Post date:** [September 9, 2019, 8:43am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/12 "2019-09-09T08:43:04Z")

</div>

All, how can I check the required index is in the hosting server (Kibana) ?

How can I import the required fields in order for me to build / load the kibana visualization.

---

<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:** [September 30, 2019, 4:43am UTC](https://discuss.elastic.co/t/trouble-configuring-agent-server/197970/13 "2019-09-30T04:43:04Z")

</div>

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