Java Agent APM won't send data to Elasticsearch

I have a java application and want to monitor it. the two hosts between the APM server and the application server are well connected. I have also deactivated the firewall but the data from the apm agent was not successfully sent to elasticsearch and did not appear in kibana

Kibana version: 8.1.0

Elasticsearch version: 8.1.0

APM Server version: 8.1.0

APM Agent language and version: JAVA version 1.35.0

Log from APM-Server:

{"log.level":"error","@timestamp":"2023-01-19T03:21:45.919-0500","log.logger":"beater","log.origin":{"":"beater/waitready.go","file.line":64},"message":"precondition failed: EOF","":"apm-server","ecs.version":"1.6.0"}
{"log.level":"error","@timestamp":"2023-01-19T03:22:00.930-0500","log.logger":"beater","log.origin":{"":"beater/waitready.go","file.line":64},"message":"precondition failed: EOF","":"apm-server","ecs.version":"1.6.0"}

Log from Catalina.out:

2023-01-19 15:38:03,543 [elastic-apm-server-reporter] WARN - null
2023-01-19 15:38:03,543 [elastic-apm-server-reporter] INFO - Backing off for 36 seconds (+/-10%)
2023-01-19 15:38:38,979 [elastic-apm-server-reporter] ERROR - Error sending data to APM server: Read timed out, response code is -1

Configuration in

export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/opt/Elastic/elastic-apm.jar -Delastic.apm.service_name=supercar -Delastic.apm.server_urls= -Delastic.apm.environment=production"

And here if i curl from application server to APM Server

Hi @zerratriani ,

Could you capture the logs using this procedure please ?

For now only the agent logs are required for investigation.

This part of the APM Server logs indicates that something is not right with the setup for the apm-server, as it cannot verify that the index templates are properly setup.

Please provide more details how you set up the APM Server (standalone or managed by Elastic Agent & Fleet) and if you have changed Elasticsearch output configurations in the APM Server.