# \[apm java agnet\]Why did I specify apm.server\_urls but still request localhost

**URL:** https://discuss.elastic.co/t/apm-java-agnet-why-did-i-specify-apm-server-urls-but-still-request-localhost/322380
**Category:** APM
**Tags:** java
**Created:** [January 3, 2023, 2:16pm UTC](https://discuss.elastic.co/t/apm-java-agnet-why-did-i-specify-apm-server-urls-but-still-request-localhost/322380 "2023-01-03T14:16:41Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ntmxglrtayl03](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ntmxglrtayl03/32/115075_2.png) [@ntmxglrtayl03](https://discuss.elastic.co/u/ntmxglrtayl03)
#### Post date: [January 3, 2023, 2:16pm UTC](https://discuss.elastic.co/t/apm-java-agnet-why-did-i-specify-apm-server-urls-but-still-request-localhost/322380/1 "2023-01-03T14:16:41Z")

</div>

**Kibana version** :  
7.17.8  
**Elasticsearch version** :  
7.17.8  
**APM Server version** :  
7.17.8  
**APM Agent language and version** :  
java 1.35.0  
**Browser version** :

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/0/104d23066632555c5e35e78f2ef044a6085ba74c.png)

---

<div class="post-metadata">

### Author: ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)
#### Post date: [January 3, 2023, 2:32pm UTC](https://discuss.elastic.co/t/apm-java-agnet-why-did-i-specify-apm-server-urls-but-still-request-localhost/322380/2 "2023-01-03T14:32:14Z")

</div>

Good question, from this screenshot I can't say why...  
Try to play a bit with your command line, see that you can pass any arbitrary system property through `-D` and verify that it is accessible through your Java program. Once you are able to do that, you should do the same passing system properties to be used by the agent.  
Otherwise, use a `elasticapm.properties` file to configure the agent instead of the command line (see [documentation](https://www.elastic.co/guide/en/apm/agent/java/current/configuration.html)).

---

<div class="post-metadata">

### Author: ![ntmxglrtayl03](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ntmxglrtayl03/32/115075_2.png) [@ntmxglrtayl03](https://discuss.elastic.co/u/ntmxglrtayl03)
#### Post date: [January 4, 2023, 9:42am UTC](https://discuss.elastic.co/t/apm-java-agnet-why-did-i-specify-apm-server-urls-but-still-request-localhost/322380/3 "2023-01-04T09:42:11Z")

</div>

-D works after I set the VM option for idea, but not in cmd

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/4/d4f5434d05861d316d359104bc072506389e6498.png)

---

<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: [January 25, 2023, 5:42am UTC](https://discuss.elastic.co/t/apm-java-agnet-why-did-i-specify-apm-server-urls-but-still-request-localhost/322380/4 "2023-01-25T05:42:38Z")

</div>

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