Error sending data to APM server: Unexpected end of file from server, response code is -1

Hello! I'm experiencing this bug. I have the ELK stack configured with the APM server running on docker.

Kibana version: 7.8.0

Elasticsearch version: 7.8.0

APM Server version: 7.8.0

APM Agent language and version: Java - APM agent automatic discover 1.18.0.RC1

I have a Java JAX-RS service running in Jetty.

The app logs: ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Error sending data to APM server: Unexpected end of file from server, response code is -1

Even if the server is reachable from the host machine via curl localhost:8200 which answers curl: (52) Empty reply from server

The agent is started using

	java -jar apm-agent-attach-standalone.jar \
    --continuous \
    --config service_name=MyName \
    --config server_urls=http://localhost:8200
	--config application_packages=com.my.package.resources

Which outputs:

2020-08-31 21:01:57.605  INFO Attaching the Elastic APM agent to 11748 null with arguments {service_name=MyName, server_urls=http://localhost:8200}
2020-08-31 21:01:58.458  INFO Done
2020-08-31 21:01:58.459  INFO Attaching the Elastic APM agent to 17008 null with arguments {service_name=MyName, server_urls=http://localhost:8200}
2020-08-31 21:01:58.469  INFO Done
2020-08-31 21:01:58.470  INFO Attaching the Elastic APM agent to 9232 null with arguments {service_name=MyName, server_urls=http://localhost:8200}
2020-08-31 21:01:58.476  INFO Done

Relevant section of docker-compose.yml:

  apm:
    build:
      context: apm/
      args:
        ELK_VERSION: $ELK_VERSION
    networks:
      - elk
    ports:
      - "8200:8200"
    depends_on:
      - other-dependance

apm-server.yml

output.elasticsearch:
  hosts: ["http://elasticsearch:9200"]
  username: "myuser"
  password: "mypassword"

apm-server.kibana.enabled: true
apm-server.kibana.host: "http://kibana:5601"

(http://elasticsearch:9200 and http://kibana:5601 are reachable)

The server itself is running on docker

...
2020-08-31T19:01:11.540Z INFO [publisher_pipeline_output] pipeline/output.go:152 Connection to backoff(elasticsearch(http://elasticsearch:9200)) established

And Kibana sees the server running

But no data is received

Am I missing something?

Thank you

Resolved it. Had a misconfiguration in the DockerFile and it was missing from the configs `apm-server.host: "0.0.0.0:8200" as stated in the docs.

Also was issueing the wrong command. The correct one is: java -jar apm-agent-attach-standalone.jar --config service_name=MyService server_urls=http://localhost:8200 application_packages=com.my.packageresources

1 Like