# Java apm agent is throwing exception errors

**URL:** <https://discuss.elastic.co/t/java-apm-agent-is-throwing-exception-errors/216970>\
**Category:** APM\
**Tags:** java\
**Created:** [January 29, 2020, 9:32am UTC](https://discuss.elastic.co/t/java-apm-agent-is-throwing-exception-errors/216970 "2020-01-29T09:32:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [January 29, 2020, 9:32am UTC](https://discuss.elastic.co/t/java-apm-agent-is-throwing-exception-errors/216970/1 "2020-01-29T09:32:37Z")

</div>

I have a java apm agent running along the java application.I can see in the application logs the following error message quite often:

```
2020-01-29 09:17:39.709 [apm-remote-config-poller] ERROR co.elastic.apm.agent.report.HttpUtils - Exception when closing input stream of HttpURLConnection.
2020-01-29 09:17:39.709 [apm-remote-config-poller] ERROR co.elastic.apm.agent.configuration.ApmServerConfigurationSource - Connection refused (Connection refused)

```

Any idea where this comes from?

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [January 29, 2020, 9:58am UTC](https://discuss.elastic.co/t/java-apm-agent-is-throwing-exception-errors/216970/2 "2020-01-29T09:58:47Z")

</div>

Hi Peter,

Those exceptions indicate that Elastic Java agent is not able to reach apm server while querying remote configuration.

Agent polls server from time to time in order to apply configuration updates, if you don't use remote configuration there is no impact outside of this error message.

From the error message `Connection refused` it looks like the APM server is down or not reachable.

When this happens, could you try from the host where the agent runs the following command `curl -v http://your-apm-server-host:8200/` where `your-apm-server-host` is the host running the APM server, and `8200` the port used for HTTP connections on this server ?

It should normally reply with `200` status code.

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [January 29, 2020, 10:43am UTC](https://discuss.elastic.co/t/java-apm-agent-is-throwing-exception-errors/216970/3 "2020-01-29T10:43:37Z")

</div>

I had one of the apm servers down. Stupid me should've though about that. Thanks anyways.

---

<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:** [February 19, 2020, 6:43am UTC](https://discuss.elastic.co/t/java-apm-agent-is-throwing-exception-errors/216970/4 "2020-02-19T06:43:40Z")

</div>

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