tags:

views:

708

answers:

4

I'm trying to get a file with ant, using the get property. I'm running apache 2, and I can get the file from the indicated URL using wget and firefox, but ant gives me the following error:

[get] Error opening connection java.io.IOException:
 Server returned HTTP response code: 503 for URL: http://localhost/jars/jai_core.jar

This is what I'm doing in my build.xml:

<get src="http://localhost/jars/jai_core.jar"
     dest="${build.dir}/lib/jai_core.jar"
     usetimestamp="true"/>

Any idea what could be going wrong?

EDIT: On to something. When I provide the full host name of my box instead of localhost, it works.

+3  A: 

503 is Service Unavailable, which probably means that the src URL isn't getting interpreted properly and sent by the ANT task or perhaps the JRE.

Here are some things to try:

  • As always, with ANT, execute the smallest possible build.xml with -verbose to see if that gives any more information, -debug for even more information.

  • Try the verbose="true" attribute on the task.

  • use "http://127.0.0.1/jars/jai_core.jar" - depending on what version of the java runtime ANT is executing under, 'localhost' may not be getting resolved correctly.

  • Drop the usetimestamp attribute just to see if it changes behavior.

  • Use another Java based application to try to perform the GET and compare results.

Ken Gentle
You can also use the -debug flag when invoking Ant to get some more information if -verbose isn't helpful enough.
matt b
It was a name resolution problem. The canonical host name was not set correctly.
Apocalisp
A: 

I seem to recall some issue with Java around this sort of thing. I don't remember the specifics but it cropped up on the netbeans mailing list awhile ago.

Osseta
A: 

The HTTP request might be going through a proxy which is rejecting the request. Alternatively ant might not be using a proxy where it should.

mhawke
A: 

Looking at th

Paul Hargreaves