# Help with configuring APM elastic agent

**URL:** <https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984>\
**Category:** APM\
**Tags:** java\
**Created:** [September 23, 2021, 9:48am UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984 "2021-09-23T09:48:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shreesh\_Narayanan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesh_narayanan/32/87312_2.png) [@Shreesh\_Narayanan](https://discuss.elastic.co/u/Shreesh_Narayanan)\
**Post date:** [September 23, 2021, 9:48am UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984/1 "2021-09-23T09:48:44Z")

</div>

hello,

I'm setting up APM for my single node ELK stack and unfamiliar with JAVA parameters . The apm-server has been set up correctly .

The instructions to set up were being followed from Kibana's APM tutorial . what am i doing wrong. ?

```auto
root@dev-elk-app01:~# java -javaagent:/home/sn/elastic-apm-agent-1.26.0.jar -Delastic.apm.service_name=apm-server -Delastic.apm.server_urls=http://172.26.207.164:8200 -Delastic.apm.secret_token= -Delastic.apm.application_packages=org.example -jar apm-server.jar
Error: Unable to access jarfile apm-server.jar

```

APM version: 7.15  
Kibana/Elasticsearch/Logstash version : 7.15

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [September 23, 2021, 10:43am UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984/2 "2021-09-23T10:43:17Z")

</div>

Have you tried putting both the java agent and jar file in the same directory oy using absolute paths ? Also file permissions?

---

<div class="post-metadata">

**Author:** ![Shreesh\_Narayanan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesh_narayanan/32/87312_2.png) [@Shreesh\_Narayanan](https://discuss.elastic.co/u/Shreesh_Narayanan)\
**Post date:** [September 23, 2021, 11:09am UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984/3 "2021-09-23T11:09:00Z")

</div>

These are the permissions

```auto
root@dev-elk-app01:/home/sn# ls -l elastic-apm-agent-1.26.0.jar 
-rwxr-xr-- 1 sn users 9320601 Sep 23 07:45 elastic-apm-agent-1.26.0.jar
root@dev-elk-app01:/home/sn# 

```

Also what did you mean by placing both java agent and jar file in the same directory ? i thought javaagent was an argument to java

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [September 23, 2021, 11:24am UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984/4 "2021-09-23T11:24:51Z")

</div>

Following the opbeans example, this worked for me. The problem with yours looks like accessing what comes after

> -jar

Seems to be where the issue is

````auto
java -javaagent:elastic-apm-agent-1.26.0.jar -Delastic.apm.service_name=opbeans-java -Delastic.apm.server_urls=https://my-apm.server.com -
Delastic.apm.environment=Development -Delastic.apm.application_packages=co.elastic.apm.opbeans -jar /home/pi/opbeans-java/opbeans/target/opbeans-0.0.1-SNAPSHOT.jar```
````

---

<div class="post-metadata">

**Author:** ![Shreesh\_Narayanan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesh_narayanan/32/87312_2.png) [@Shreesh\_Narayanan](https://discuss.elastic.co/u/Shreesh_Narayanan)\
**Post date:** [September 23, 2021, 11:45am UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984/5 "2021-09-23T11:45:26Z")

</div>

okay , that seemed to have worked

```auto
root@dev-elk-app01:~# java -javaagent:/home/sn/elastic-apm-agent-1.26.0.jar -Delastic.apm.service_name=apm-server -Delastic.apm.server_urls=http://172.26.207.164:8200 -Delastic.apm.secret_token= -Delastic.apm.application_packages=org.example -jar /home/sn/elastic-apm-agent-1.26.0.jar 
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-09-23 11:35:11,461 [main] INFO co.elastic.apm.agent.util.JmxUtils - Found JVM-specific OperatingSystemMXBean interface: com.sun.management.OperatingSystemMXBean
2021-09-23 11:35:11,514 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.26.0 as apm-server on Java 11.0.11 Runtime version: 11.0.11+9-Ubuntu-0ubuntu2.18.04 VM version: 11.0.11+9-Ubuntu-0ubuntu2.18.04 (Ubuntu) Linux 4.15.0-154-generic
2021-09-23 11:35:11,514 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - service_name: 'apm-server' (source: Java System Properties)
2021-09-23 11:35:11,514 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - secret_token: 'XXXX' (source: Java System Properties)
2021-09-23 11:35:11,515 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - server_urls: 'http://172.26.207.164:8200' (source: Java System Properties)
2021-09-23 11:35:11,515 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - application_packages: 'org.example' (source: Java System Properties)
2021-09-23 11:35:12,951 [main] INFO co.elastic.apm.agent.impl.ElasticApmTracer - Tracer switched to RUNNING state
2021-09-23 11:35:12,953 [elastic-apm-server-healthcheck] INFO co.elastic.apm.agent.report.ApmServerHealthChecker - Elastic APM server is available: { "build_date": "2021-09-16T02:05:39Z", "build_sha": "a183f675ecd03fca4a897cbe85fda3511bc3ca43", "version": "7.15.0"}
no main manifest attribute, in /home/sn/elastic-apm-agent-1.26.0.jar
root@dev-elk-app01:~# 

```

---

<div class="post-metadata">

**Author:** ![Shreesh\_Narayanan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesh_narayanan/32/87312_2.png) [@Shreesh\_Narayanan](https://discuss.elastic.co/u/Shreesh_Narayanan)\
**Post date:** [September 23, 2021, 11:46am UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984/6 "2021-09-23T11:46:48Z")

</div>

![Screen Shot 2021-09-23 at 5.15.46 PM](https://us1.discourse-cdn.com/elastic/original/3X/9/9/995acf3d084c6861d1047a956d3eef15e31fb03e.jpeg)

any suggestions on how i could fix this

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [September 23, 2021, 12:03pm UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984/7 "2021-09-23T12:03:26Z")

</div>

> [@Shreesh\_Narayanan](#):
>
> ```auto
> root@dev-elk-app01:~# java -javaagent:/home/sn/elastic-apm-agent-1.26.0.jar -Delastic.apm.service_name=apm-server -Delastic.apm.server_urls=http://172.26.207.164:8200 -Delastic.apm.secret_token= -Delastic.apm.application_packages=org.example -jar /home/sn/elastic-apm-agent-1.26.0.jar 
> OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
> WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
> 
> ```

Shouldn't you be pointing to your application and not the apm agent?

```auto
-jar apm-server.jar

```

---

<div class="post-metadata">

**Author:** ![Shreesh\_Narayanan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesh_narayanan/32/87312_2.png) [@Shreesh\_Narayanan](https://discuss.elastic.co/u/Shreesh_Narayanan)\
**Post date:** [September 23, 2021, 12:07pm UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984/8 "2021-09-23T12:07:43Z")

</div>

i did try it , had the same error after specifying the absolute path .

```auto
root@dev-elk-app01:~# java -javaagent:/home/sn/elastic-apm-agent-1.26.0.jar -Delastic.apm.service_name=apm-server -Delastic.apm.server_urls=http://172.26.207.164:8200 -Delastic.apm.secret_token= -Delastic.apm.application_packages=org.example -jar /home/sn/apm-server.jar
Error: Unable to access jarfile /home/sn/apm-server.jar

```

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [September 23, 2021, 12:10pm UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984/9 "2021-09-23T12:10:01Z")

</div>

> [@Shreesh\_Narayanan](#):
>
> `apm-server.jar`

Your syntax is connect and you did get previously a response to saying you Elastic APM server was up and running. Could it be the application itself? Maybe try running a control test by following the opbeans tutorial ?

---

<div class="post-metadata">

**Author:** ![Shreesh\_Narayanan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesh_narayanan/32/87312_2.png) [@Shreesh\_Narayanan](https://discuss.elastic.co/u/Shreesh_Narayanan)\
**Post date:** [September 23, 2021, 12:39pm UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984/10 "2021-09-23T12:39:51Z")

</div>

i was looking at the logs, and looks it is running . seems  
like the index is mising

```auto
Sep 23 12:37:06 dev-elk-app01 apm-server[23831]: {"log.level":"error","@timestamp":"2021-09-23T12:37:06.247Z","log.logger":"publisher_pipeline_output","log.origin":{"file.name":"pipeline/output.go","file.line":154},"message":"Failed to connect to backoff(elasticsearch(http://172.26.207.164:9200/app/ELK-Logs/apm-server)): 404 Not Found: {\"error\":{\"root_cause\":[{\"type\":\"index_not_found_exception\",\"reason\":\"no such index [app]\",\"resource.type\":\"index_expression\",\"resource.id\":\"app\",\"index_uuid\":\"_na_\",\"index\":\"app\"}],\"type\":\"index_not_found_exception\",\"reason\":\"no such index [app]\",\"resource.type\":\"index_expression\",\"resource.id\":\"app\",\"index_uuid\":\"_na_\",\"index\":\"app\"},\"status\":404}","service.name":"apm-server","ecs.version":"1.6.0"}

```

---

<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 14, 2021, 8:40am UTC](https://discuss.elastic.co/t/help-with-configuring-apm-elastic-agent/284984/11 "2021-10-14T08:40:05Z")

</div>

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