Apm-agent-java don't work

Hi friends, I configured elastic-agent with elastic-agent-java to monitoring app myapp.jar, but I have the follow error:

ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Error sending data to APM server: Server returned HTTP response code: 403 for URL: [https://54c680e5619d41b690de8c04fe592dcb.apm.us-central1.gcp.cloud.es.io:443/intake/v2/events](https://54c680e5619d41b690de8c04fe592dcb.apm.us-central1.gcp.cloud.es.io/intake/v2/events), response code is 403
2022-10-04 06:56:56,926 [elastic-apm-server-reporter] WARN co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - {
"accepted": 0,
"errors": [
{
"message": "unauthorized: anonymous access not permitted for agent \"java\""
}
]
}

Looks like you have to configure the secret token. See also Secret token | APM User Guide [8.4] | Elastic

Hi @felixbarny , I have the follow configuration to instrument agent Java with the server APM and run this command to up the app:

The secret tocket is configured. But whe I start the app only start the app or if I change de sort of command only start the agent, so I think that the command is wrong.

java -Xms512m -Xmx6144m -javaagent:/home/centos/app/digitall/apps/elastic-agent/elastic-apm-agent-1.34.1.jar -Delastic.apm.service_name=digitall-rest -Delastic.apm.server_url= https://54c680e5619d41b690de8c04fe592dcb.apm.us-central1.gcp.cloud.es.io:443 -Delastic.apm.secret_token=**** -Delastic.apm.environment=dev -Delastic.apm.application_packages=org.example -jar digitall-rest-1.0.jar --spring.config.location=file:application.properties

Attatch configuration agen_policy wint apm Integration.

Hi @odelacruzc ,

Could you provide debug logs from your agent? This will help us identify potential configuration issues.