Mykel Alvis wrote:
Hi,
I'm testing out ivy 1.4.1 for purposes of possibly integrating it into a
build stream and I can't seem to get the initial test to work for me.

I AM behind a National Socialistic-esque proxy firewall that does virus
checking on each and every file that comes across the internet connection,
but that's the
way it is here and nothing's likely to change in that respect.  Since I'm
working on a Linux box on this primarily Windows network, I get little to no
support for any proxy issues I experience.


Well, you are now talking to the official maintainer of proxy settings for Ant. As I work behind a firewall, I get to experience the joy of proxies myself. Sometimes I have to work from home just to have a direct link with third party web service endpoints.

Trying to get proxies right in Java is hard. The problems are it is different for every private network, and every Java platform. You need different boxes in private networks to test reliably. There is better support/awareness in Java1.5, but it is java1.5 only, so ant cannot make easy use of it.


I got a previous failure with "Server Redirected too many times". Following some incidental advice in a forum posting, I added the commons-httpclient to
my CLASSPATH before invoking ant.  This seemed to just cause a hanging of
the process.

I did add a line into the "test" build.xml file as follows, with the obvious
appropriate changes:

<setproxy proxyhost="PROXY.IP.HERE" proxypassword="mypass"
proxyuser="myuser" proxyport="PROXY.PORT" />

that's an ant task to set the java http.proxyHost and http.ProxyPort properties. There are some other options you can se t

> echo $ANT_OPTS
-Dhttp.proxyHost=web-proxy -Dhttp.proxyPort=8088


HttpClient doesnt use these system settings. My Alpine soap stack has to copy them by hand.


This also did not help.

I also set my http_proxy variable to the authenticated proxy location which
did not help.

The error seems typically to be " java.net.ConnectException Connection timed
out:  connect"  which might be expected if one were having difficulty
navigating an external connection.


I did not expand my  commons-httpclient logging yet, as it is starting to
seem as if this process might be more trouble than it's worth.


Unless Ivy is setting up the proxy, it is too much trouble.

1. Ant1.7.0RC1, which is available somewhere, does proxy diagnostics if you go
ant -diagnostics

2. That same version of Ant, running on Java1.5, tries to get the proxy settings from the OS, as documented in
http://ant.apache.org/manual-rc/proxy.html

You can get the same effect as #2 by going java.net.useSystemProxies=true in Ant OPTS. In theory, this switch will pull out proxy settings from the OS. In windows, that means IE. In linux, well, nobody knows what it means. It doesnt find the default web browser and ask it. It doesnt ask KDE what it is. I think it may ask Gnome, or it may ask for the http_proxy settings.

My recommendations are

-try setting
ANT_OPTS=java.net.useSystemProxies=true

ANT_OPTS=-Dhttp.proxyHost=myproxy -Dhttp.proxyPort=8080 +password ptions

Further reading
http://java.sun.com/j2se/1.5.0/docs/guide/net/properties.html
http://blogs.sun.com/roller/resources/jcc/Proxies.pdf


I'm thinking of writing some commons-proxysetup package in the future to do proxies right in Java
 -extract it from the OS reliably
-have some java-app-wide override point where it can be set once for all apps -have a dynamic 'proxy changed' event to notify listening apps that everything has changed. One option may just be to implement a private proxy that runs on localhost to do the dynamicness; everything is pointed at a local proxy that relays stuff direct or via a proxy server. We could make that smart and Java1.5+; if an nslookup("web.proxy") fails then we know there is no local proxy server, so try going direct, etc, etc. By putting the intelligence in a single app, we stop relying on every Java app developer in the world to get the logic right, logic that cannot be tested except by us behind-the-firewall people.

-steve

Reply via email to