I am doing some web sevices work on Java 5 on a mac (10.6.2)....
Ever since IT made us start using a proxy server, life has gotten a lot harder. Java appears to be pulling in the system proxy server settings, but not the exclude list. This means when I try to call a web service for "localhost", java tries to his the proxy server instead and my call blows up. Same for my hostname or IP.
So to work in the office, I have to go to System Settings and remove the proxy configuration. Then it's all good, except I can't hit the internet. No matter what I do in my system settings with the exclude list, it has no effect on Java.
I have tried -Djava.net.useSystemProxies=false and it didn't seem to do anything.
thanks for any help!
The definitive reference for network proxy configuration in Java 5 is this Java Networking and Proxies page. From this page, it seems that Java 5 pays no attention to the system settings from the host environment. But even if it is supposed to pay attention to them, the fact that this is (apparently) not working for you means that you should not be relying on this ... at least for now.
In order to explicitly configure a Java 5 JVM to use a default proxy for HTTP you need to set the Java system properties:
http.proxyHost
- the DNS or IP address of the proxyhttp.proxyPort
- the port number for the proxyhttp.nonProxyHosts
- a list of hosts or domains to connect to directly, separated by the "pipe" character |
.If you are using HTTPS as well, you also need to configure https.proxyHost
and https.proxyPort
.
And, I think you have to set http.proxyHost
for http.nonProxyHosts
to have any effect. Setting the latter by itself may have no effect.
More details are in the page linked above. I'd recommending using "-D" options in the command script that you use to launch the app. Maybe you could make this script pull the proxy parameters from the system settings.
Note that in Java 6 and later, network proxy support changes (again) and a Java 6 JVM will pick up and use system settings from the host environment under certain circumstances.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With