APM agent for java is not working

HI,

I attached the elastic apm agent to my spring boot application as per https://www.elastic.co/guide/en/apm/agent/java/current/setup-javaagent.html . I created a deployment for APM server in elastic cloud console as well.But the java agent is not sending any data to APM server.

This is the command line argument for jar
java -javaagent:/data/tools/elastic-apm-agent-1.17.0.jar -Delastic.apm.service_name=xxxx -Delastic.apm.server_url=https://ed1eb8xxxxxxxxxxxxeu-west-1.aws.cloud.es.io:443 -Delastic.apm.secret_token=xxxxxxxxxxxxxxxxxxxx -Delastic.apm.application_packages=xxxx.xxx.xxx -jar -Xmx6g -Dspring.profiles.active=ecomqa -Dspring.profiles.include=qa -Dfile.encoding=UTF8 -Ddebug /data/xxxx.jar

Here is the link for the debug logs https://gist.github.com/gijomathew7/01be00ae4907c359255557f64031afff

Could you set -Delastic.apm.log_level=debug and send the logs again? There's not much I can see from the logs other than that the agent successfully established a connection to APM Server:

2020-06-25 13:30:20,039 [main] INFO  co.elastic.apm.agent.util.JmxUtils - Found JVM-specific OperatingSystemMXBean interface: com.sun.management.OperatingSystemMXBean
2020-06-25 13:30:21,884 [main] INFO  co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.17.0 as SIFU on Java 1.8.0_242 (Oracle Corporation) Linux 3.10.0-514.16.1.el7.x86_64
2020-06-25 13:30:21,885 [main] WARN  co.elastic.apm.agent.configuration.StartupInfo - Detected usage of an old configuration key: 'server_url'. Please use 'server_urls' instead.
2020-06-25 13:30:21,922 [main] INFO  co.elastic.apm.agent.impl.ElasticApmTracer - Tracer switched to RUNNING state
2020-06-25 13:30:22,808 [elastic-apm-server-healthcheck] INFO  co.elastic.apm.agent.report.ApmServerHealthChecker - Elastic APM server is available: {"ok":{"build_date":"2019-06-18T12:11:59Z","build_sha":"2e58a05c97d4551aca59ef09aff651c79ea3f4db","version":"6.8.1"}}

Which web framework are you using in your spring boot application? Is it Spring MVC on a Tomcat server?

Could you test if version 1.15.0 is working for you as expected? Is there a chance you could test with a more recent version of APM Server?

Hi,

I have changed the agent version to 1.15.0 and the logs are availabe at https://gist.github.com/gijomathew7/3b268ace2d26d10e351e0b37b3cab1a1.
The APM server version is 6.8.1
The application is spring MVC on Tomcat server.

Logs look good. There are 23 reported events:

2020-06-26 09:11:46.717 [elastic-apm-init-instrumentation-shutdown-hook] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Reported events: 23

So it seems like the events could successfully be sent to your APM Server.