# Unable to start Agent ( could not find or load main class .apm.service\_name=DemoApplication )

**URL:** <https://discuss.elastic.co/t/unable-to-start-agent-could-not-find-or-load-main-class-apm-service-name-demoapplication/181811>\
**Category:** APM\
**Tags:** java\
**Created:** [May 20, 2019, 12:27pm UTC](https://discuss.elastic.co/t/unable-to-start-agent-could-not-find-or-load-main-class-apm-service-name-demoapplication/181811 "2019-05-20T12:27:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Badem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badem/32/45225_2.png) [@Badem](https://discuss.elastic.co/u/Badem)\
**Post date:** [May 20, 2019, 12:27pm UTC](https://discuss.elastic.co/t/unable-to-start-agent-could-not-find-or-load-main-class-apm-service-name-demoapplication/181811/1 "2019-05-20T12:27:25Z")

</div>

Hello, everyone

Im currently testing APM with springboot application, and i'm getting error while starting the Agent.

\*\* Thank you in advance for your help \*\*

**Kibana version** : 7.0.1

**Elasticsearch version** : 7.0.1

**APM Server version** : 7.0.1

**APM Agent language and version** : JAVA 1.6.1

**Browser version** : chrome Version 74.0.3729.131

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: download page, windows 10, script from kibana interface

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

**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.

i changed index pattern and set-up template in apm-server.yml :  
// apm-server:  
host: "localhost:8200"  
output.elasticsearch:  
hosts: ["localhost:9200"]  
index: "testapm-%{[observer.version]}-%{+yyyy.MM.dd}"

```
setup.template.name: "apm-%{[observer.version]}"
setup.template.pattern: "apm-%{[observer.version]}-*"
setup.kibana.host: "localhost:5601"

```

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

Unable to start agent cause :

// Error: Could not find or load main class .apm.service\_name=DemoApplication  
Caused by: java.lang.ClassNotFoundException: /apm/service\_name=DemoApplication

\*\*windows powershell command used : \*\*  
// & "C:\Program Files\Java\jdk-11.0.2\bin\java.exe" -javaagent:elastic-apm-agent-1.6.1.jar -Delasti  
c.apm.service\_name=DemoApplication -Delastic.apm.server\_url=http://localhost:8200 -Delastic.apm.application\_packages=com.example.demo -jar demo.jar

**Provide logs and/or server output (if relevant)**:

\*\* Agent output after command execution\*\*

//2019-05-20 14:04:50.687 [apm-server-healthcheck] INFO co.elastic.apm.agent.report.ApmServerHealthChecker - Elastic APM server is available: { "build\_date": "2019-04-29T11:46:07Z", "build\_sha": "79e123dbf8c042b1e3cfa30260910ae7e93939d2", "version": "7.0.1"}  
2019-05-20 14:04:50.714 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.6.1 as demo on Java 11.0.2 (Oracle Corporation) Windows 10 10.0  
2019-05-20 14:04:50.715 [main] WARN co.elastic.apm.agent.configuration.StartupInfo - To enable all features and to increase startup times, please configure application\_packages  
Error: Could not find or load main class .apm.service\_name=DemoApplication  
Caused by: java.lang.ClassNotFoundException: /apm/service\_name=DemoApplication

\*\* Apm-server output \*\*  
Apm server is started :

// C:\Program Files\Apm-Server\>apm-server.exe -c apm-server.yml -e

2019-05-20T10:42:02.706+0200 INFO [beat] instance/beat.go:872 Process info {"system\_info": {"process": {"cwd": "C:\Program Files\Apm-Server", "exe": "C:\Program Files\Apm-Server\apm-server.exe", "name": "apm-server.exe", "pid": 15348, "ppid": 13036, "start\_time": "2019-05-20T10:42:01.908+0200"}}}  
2019-05-20T10:42:02.716+0200 INFO instance/beat.go:280 Setup Beat: apm-server; Version: 7.0.1  
2019-05-20T10:42:02.717+0200 INFO elasticsearch/client.go:165 Elasticsearch url: [http://localhost:9200](http://localhost:9200)  
2019-05-20T10:42:02.718+0200 INFO [publisher] pipeline/module.go:97 Beat name: LFR018011  
2019-05-20T10:42:02.721+0200 INFO [beater] beater/beater.go:118 No pipeline callback registered  
2019-05-20T10:42:02.722+0200 INFO instance/beat.go:391 apm-server start running.  
2019-05-20T10:42:02.723+0200 INFO [beater] beater/beater.go:216 self instrumentation is disabled  
2019-05-20T10:42:02.756+0200 INFO [beater] beater/beater.go:154 host resolved from localhost:8200 to 127.0.0.1:8200  
2019-05-20T10:42:02.756+0200 INFO [handler] beater/route\_config.go:94 Path /assets/v1/sourcemaps added to request handler  
2019-05-20T10:42:02.764+0200 INFO [handler] beater/route\_config.go:99 Path /intake/v2/events added to request handler  
2019-05-20T10:42:02.765+0200 INFO [handler] beater/route\_config.go:99 Path /intake/v2/rum/events added to request handler  
2019-05-20T10:42:02.766+0200 INFO [server] beater/server.go:66 Starting apm-server [79e123dbf8c042b1e3cfa30260910ae7e93939d2 built 2019-04-29 11:46:07 +0000 UTC]. Hit CTRL-C to stop it.  
2019-05-20T10:42:02.770+0200 INFO [server] beater/server.go:67 Listening on: 127.0.0.1:8200  
2019-05-20T10:42:02.770+0200 INFO [server] beater/server.go:72 RUM endpoints disabled  
2019-05-20T10:42:02.778+0200 INFO [request] beater/common\_handler.go:185 handled request {"request\_id": "2b975648-1454-457c-b2b0-8b81672fe369", "method": "GET", "URL": "/", "content\_length": 0, "remote\_address": "127.0.0.1", "user-agent": "Go-http-client/1.1", "response\_code": 200}  
2019-05-20T10:42:02.780+0200 INFO [http\_client] beater/client.go:49 HTTP Server ready  
2019-05-20T10:42:02.781+0200 INFO [onboarding] beater/onboarding.go:36 Publishing onboarding document  
2019-05-20T10:42:03.788+0200 INFO pipeline/output.go:95 Connecting to backoff(elasticsearch([http://localhost:9200](http://localhost:9200)))  
2019-05-20T10:42:03.820+0200 INFO elasticsearch/client.go:734 Attempting to connect to Elasticsearch version 7.0.0  
2019-05-20T10:42:03.859+0200 INFO template/load.go:129 Template already exists and will not be overwritten.  
2019-05-20T10:42:03.859+0200 INFO [index-management] idxmgmt/supporter.go:196 Loaded index template.  
2019-05-20T10:42:03.862+0200 INFO pipeline/output.go:105 Connection to backoff(elasticsearch([http://localhost:9200](http://localhost:9200))) established

---

<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:** [May 20, 2019, 12:35pm UTC](https://discuss.elastic.co/t/unable-to-start-agent-could-not-find-or-load-main-class-apm-service-name-demoapplication/181811/2 "2019-05-20T12:35:14Z")

</div>

> [@Badem](#):
>
> // & "C:\Program Files\Java\jdk-11.0.2\bin\java.exe" -javaagent:elastic-apm-agent-1.6.1.jar -Delasti  
> c.apm.service\_name=DemoApplication -Delastic.apm.server\_url=[http://localhost:8200](http://localhost:8200) -Delastic.apm.application\_packages=com.example.demo -jar demo.jar

Your command line has a problem, probably a new-line in `-Delasti c.apm.service_name=DemoApplication`  
Use a single line.

---

<div class="post-metadata">

**Author:** ![Badem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badem/32/45225_2.png) [@Badem](https://discuss.elastic.co/u/Badem)\
**Post date:** [May 20, 2019, 12:54pm UTC](https://discuss.elastic.co/t/unable-to-start-agent-could-not-find-or-load-main-class-apm-service-name-demoapplication/181811/3 "2019-05-20T12:54:04Z")

</div>

Thank you for your answer, but in powershell terminal, command is in single line.  
the new line has appeared while posting a comment.

---

<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:** [May 20, 2019, 1:50pm UTC](https://discuss.elastic.co/t/unable-to-start-agent-could-not-find-or-load-main-class-apm-service-name-demoapplication/181811/4 "2019-05-20T13:50:48Z")

</div>

> [@Badem](#):
>
> // Error: Could not find or load main class .apm.service\_name=DemoApplication  
> Caused by: java.lang.ClassNotFoundException: /apm/service\_name=DemoApplication

I can't say for sure what the problem is with the command line, you need to figure it out. All I know is that the Java looks for a main class called `.apm.service_name=DemoApplication`, which seems to be due to problem with command line argument parsing

---

<div class="post-metadata">

**Author:** ![Badem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badem/32/45225_2.png) [@Badem](https://discuss.elastic.co/u/Badem)\
**Post date:** [May 20, 2019, 2:17pm UTC](https://discuss.elastic.co/t/unable-to-start-agent-could-not-find-or-load-main-class-apm-service-name-demoapplication/181811/5 "2019-05-20T14:17:14Z")

</div>

Ok, i 'll try to figure it out.  
Thank you for your support 👍

---

<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:** [June 10, 2019, 10:17am UTC](https://discuss.elastic.co/t/unable-to-start-agent-could-not-find-or-load-main-class-apm-service-name-demoapplication/181811/6 "2019-06-10T10:17:17Z")

</div>

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