# APM agent could not connect to APM server

**URL:** <https://discuss.elastic.co/t/apm-agent-could-not-connect-to-apm-server/283576>\
**Category:** APM\
**Tags:** java\
**Created:** [September 7, 2021, 7:42pm UTC](https://discuss.elastic.co/t/apm-agent-could-not-connect-to-apm-server/283576 "2021-09-07T19:42:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramm](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@ramm](https://discuss.elastic.co/u/ramm)\
**Post date:** [September 7, 2021, 7:42pm UTC](https://discuss.elastic.co/t/apm-agent-could-not-connect-to-apm-server/283576/1 "2021-09-07T19:42:11Z")

</div>

Hi, I have installed APM Java agent(elastic-apm-agent-1.25.0) and instrumented IBM Websphere JVM, however I see the following error in the agent log

```auto
2021-09-07 15:40:58,900 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Error trying to connect to APM Server at http://mifrd14243.glicus.com:8200/intake/v2/events. Some details about SSL configurations corresponding the current connection are logged at INFO level.
2021-09-07 15:40:58,900 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type JSON_WRITER with this error: connect timed out
2021-09-07 15:40:58,900 [elastic-apm-server-reporter] DEBUG co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Event handling failure
java.net.SocketTimeoutException: connect timed out
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:236) ~[?:1.8.0]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:218) ~[?:1.8.0]
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183) ~[?:1.8.0]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403) ~[?:1.8.0]
	at java.net.Socket.connect(Socket.java:682) ~[?:1.8.0]
	at sun.net.NetworkClient.doConnect(NetworkClient.java:187) ~[?:1.8.0]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:494) ~[?:1.8.0]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:589) ~[?:1.8.0]
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:256) ~[?:1.8.0]
	at sun.net.www.http.HttpClient.New(HttpClient.java:360) ~[?:1.8.0]
	at sun.net.www.http.HttpClient.New(HttpClient.java:378) ~[?:1.8.0]
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1238) ~[?:1.8.0]
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1174) ~[?:1.8.0]
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1068) ~[?:1.8.0]
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1002) ~[?:1.8.0]
	at co.elastic.apm.agent.report.AbstractIntakeApiHandler.startRequest(AbstractIntakeApiHandler.java:104) ~[?:?]
	at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.startRequest(IntakeV2ReportingEventHandler.java:145) ~[?:?]
	at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.handleEvent(IntakeV2ReportingEventHandler.java:87) [?:?]
	at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.onEvent(IntakeV2ReportingEventHandler.java:65) [?:?]
	at co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.onEvent(IntakeV2ReportingEventHandler.java:36) [?:?]
	at co.elastic.apm.agent.shaded.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:168) [?:?]
	at co.elastic.apm.agent.shaded.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:125) [?:?]
	at java.lang.Thread.run(Thread.java:818) [?:2.9 (11-06-2019)]
2021-09-07 15:40:58,900 [elastic-apm-server-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)

```

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [September 8, 2021, 6:44am UTC](https://discuss.elastic.co/t/apm-agent-could-not-connect-to-apm-server/283576/2 "2021-09-08T06:44:58Z")

</div>

Hi and thanks for your question.

Looks like a connection issue.  
Check out this troubleshooting guide: [Troubleshooting | APM Java Agent Reference [1.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/java/current/trouble-shooting.html#trouble-shooting-no-data).

Let us know if that helped. If it didn't, please update this thread with whatever you've found out along the way.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 29, 2021, 2:45am UTC](https://discuss.elastic.co/t/apm-agent-could-not-connect-to-apm-server/283576/3 "2021-09-29T02:45:39Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
