Unable to start Agent ( could not find or load main class .apm.service_name=DemoApplication )

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
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))
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)) established

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

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

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

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

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