APM agent not able to connect apm server

Hi Team,

We were able to install elastic search, kibana and apm server successfully on MacOS and apm agent was hooked with the application deployed in ubuntu but not able to connect to apm server.

Kibana version:
7.5.1
Elasticsearch version:
7.5.1
APM Server version:
7.5.1
APM Agent language and version:
Java 7.5.1

Fresh install or upgraded from other version?
Fresh install

**Description of the problem including expected versus actual behavior. Please include screenshots config used:
-javaagent:/elasticapmagent/elastic-apm-agent-1.12.0.jar

-Delastic.apm.service_name=sampleserv

-Delastic.apm.server_url=http://apm-serveripaddress:8200

-Delastic.apm.log_level=DEBUG

Steps to reproduce:
1.
2.
3.

Provide logs and/or server output (if relevant):
INFO | jvm 1 | 2020/01/13 08:32:24 | java.net.SocketTimeoutException: connect timed out
INFO | jvm 1 | 2020/01/13 08:32:24 | at java.net.PlainSocketImpl.socketConnect(Native Method)
INFO | jvm 1 | 2020/01/13 08:32:24 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
INFO | jvm 1 | 2020/01/13 08:32:24 | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
INFO | jvm 1 | 2020/01/13 08:32:24 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
INFO | jvm 1 | 2020/01/13 08:32:24 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
INFO | jvm 1 | 2020/01/13 08:32:24 | at java.net.Socket.connect(Socket.java:589)
INFO | jvm 1 | 2020/01/13 08:32:24 | at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
INFO | jvm 1 | 2020/01/13 08:32:24 | at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
INFO | jvm 1 | 2020/01/13 08:32:24 | at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
INFO | jvm 1 | 2020/01/13 08:32:24 | at sun.net.www.http.HttpClient.(HttpClient.java:242)
INFO | jvm 1 | 2020/01/13 08:32:24 | at sun.net.www.http.HttpClient.New(HttpClient.java:339)
INFO | jvm 1 | 2020/01/13 08:32:24 | at sun.net.www.http.HttpClient.New(HttpClient.java:357)
INFO | jvm 1 | 2020/01/13 08:32:24 | at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
INFO | jvm 1 | 2020/01/13 08:32:24 | at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
INFO | jvm 1 | 2020/01/13 08:32:24 | at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
INFO | jvm 1 | 2020/01/13 08:32:24 | at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
INFO | jvm 1 | 2020/01/13 08:32:24 | at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.startRequest(IntakeV2ReportingEventHandler.java:200)
INFO | jvm 1 | 2020/01/13 08:32:24 | at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.handleEvent(IntakeV2ReportingEventHandler.java:138)
INFO | jvm 1 | 2020/01/13 08:32:24 | at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.onEvent(IntakeV2ReportingEventHandler.java:116)
INFO | jvm 1 | 2020/01/13 08:32:24 | at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.onEvent(IntakeV2ReportingEventHandler.java:50)
INFO | jvm 1 | 2020/01/13 08:32:24 | at co.elastic.apm.agent.shaded.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:168)
INFO | jvm 1 | 2020/01/13 08:32:24 | at co.elastic.apm.agent.shaded.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:125)
INFO | jvm 1 | 2020/01/13 08:32:24 | at java.lang.Thread.run(Thread.java:748)
INFO | jvm 1 | 2020/01/13 08:32:24 | 2020-01-13 08:32:24.872 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)

INFO | jvm 1 | 2020/01/13 08:31:21 | 2020-01-13 08:31:20.991 [apm-remote-config-poller] DEBUG co.elastic.apm.agent.configuration.ApmServerConfigurationSource - Reloading configuration from APM Server http://10.229.100.178:8200/config/v1/agents
INFO | jvm 1 | 2020/01/13 08:31:26 | 2020-01-13 08:31:25.992 [apm-remote-config-poller] DEBUG co.elastic.apm.agent.report.ApmServerClient - Exception while interacting with APM Server, trying next one.
INFO | jvm 1 | 2020/01/13 08:31:31 | 2020-01-13 08:31:30.997 [apm-remote-config-poller] ERROR co.elastic.apm.agent.report.HttpUtils - Exception when closing input stream of HttpURLConnection.
INFO | jvm 1 | 2020/01/13 08:31:31 | 2020-01-13 08:31:30.997 [apm-remote-config-poller] ERROR co.elastic.apm.agent.configuration.ApmServerConfigurationSource - connect timed out
INFO | jvm 1 | 2020/01/13 08:31:31 | 2020-01-13 08:31:30.997 [apm-remote-config-poller] DEBUG co.elastic.apm.agent.configuration.ApmServerConfigurationSource - Scheduling next remote configuration reload in 300s
INFO | jvm 1 | 2020/01/13 08:31:40 | 2020-01-13 08:31:40.632 [apm-reporter] DEBUG co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Receiving METRICS event (sequence 25)
INFO | jvm 1 | 2020/01/13 08:31:40 | 2020-01-13 08:31:40.633 [apm-reporter] DEBUG co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Starting new request to http://10.229.100.178:8200/intake/v2/events
INFO | jvm 1 | 2020/01/13 08:31:45 | 2020-01-13 08:31:45.638 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: connect timed out
INFO | jvm 1 | 2020/01/13 08:31:45 | 2020-01-13 08:31:45.638 [apm-reporter] DEBUG co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Event handling failure
INFO | jvm 1 | 2020/01/13 08:31:45 | java.net.SocketTimeoutException: connect timed out
INFO | jvm 1 | 2020/01/13 08:31:45 | at java.net.PlainSocketImpl.socketConnect(Native Method)
INFO | jvm 1 | 2020/01/13 08:31:45 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
INFO | jvm 1 | 2020/01/13 08:31:45 | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
INFO | jvm 1 | 2020/01/13 08:31:45 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
INFO | jvm 1 | 2020/01/13 08:31:45 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
INFO | jvm 1 | 2020/01/13 08:31:45 | at java.net.Socket.connect(Socket.java:589)
INFO | jvm 1 | 2020/01/13 08:31:45 | at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
INFO | jvm 1 | 2020/01/13 08:31:45 | at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
INFO | jvm 1 | 2020/01/13 08:31:45 | at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
INFO | jvm 1 | 2020/01/13 08:31:45 | at sun.net.www.http.HttpClient.(HttpClient.java:242)
INFO | jvm 1 | 2020/01/13 08:31:45 | at sun.net.www.http.HttpClient.New(HttpClient.java:339)
INFO | jvm 1 | 2020/01/13 08:31:45 | at sun.net.www.http.HttpClient.New(HttpClient.java:357)
INFO | jvm 1 | 2020/01/13 08:31:45 | at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
INFO | jvm 1 | 2020/01/13 08:31:45 | at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
INFO | jvm 1 | 2020/01/13 08:31:45 | at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
INFO | jvm 1 | 2020/01/13 08:31:45 | at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
INFO | jvm 1 | 2020/01/13 08:31:45 | at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.startRequest(IntakeV2ReportingEventHandler.java:200)
INFO | jvm 1 | 2020/01/13 08:31:45 | at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.handleEvent(IntakeV2ReportingEventHandler.java:138)
INFO | jvm 1 | 2020/01/13 08:31:45 | at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.onEvent(IntakeV2ReportingEventHandler.java:116)
INFO | jvm 1 | 2020/01/13 08:31:45 | at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.onEvent(IntakeV2ReportingEventHandler.java:50)
INFO | jvm 1 | 2020/01/13 08:31:45 | at co.elastic.apm.agent.shaded.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:168)
INFO | jvm 1 | 2020/01/13 08:31:45 | at co.elastic.apm.agent.shaded.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:125)
INFO | jvm 1 | 2020/01/13 08:31:45 | at java.lang.Thread.run(Thread.java:748)
INFO | jvm 1 | 2020/01/13 08:31:45 | 2020-01-13 08:31:45.639 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
INFO | jvm 1 | 2020/01/13 08:32:19 | 2020-01-13 08:32:19.869 [apm-reporter] DEBUG co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Receiving METRICS event (sequence 26)
INFO | jvm 1 | 2020/01/13 08:32:19 | 2020-01-13 08:32:19.869 [apm-reporter] DEBUG co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Starting new request to http://10.229.100.178:8200/intake/v2/events
INFO | jvm 1 | 2020/01/13 08:32:24 | 2020-01-13 08:32:24.872 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: connect timed out
INFO | jvm 1 | 2020/01/13 08:32:24 | 2020-01-13 08:32:24.872 [apm-reporter] DEBUG co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Event handling failure

Hi and thanks for you question. Check out this part of the troubleshooting guide: https://www.elastic.co/guide/en/apm/agent/java/current/trouble-shooting.html#trouble-shooting-no-data