You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "Ing. Jiří Nejedlý" <ji...@seznam.cz> on 2006/09/21 16:39:10 UTC

Stuck at the start - HTTPClientTutorial won't work

Hi, 
I cannot make HTTPClientTutorial work. I use Oracle's JDeveloper 10.1.2. I added these libraries into my project  - commons-codec-1.3.jar,  commons-httpclient-3.0.1.jar,  commons-logging-1.1.jar, but it still gives me this error:

Fatal transport error: www.apache.org

java.net.UnknownHostException: www.apache.org

	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)

	at java.net.Socket.connect(Socket.java:452)

	at java.net.Socket.connect(Socket.java:402)

	at java.net.Socket.<init>(Socket.java:309)

	at java.net.Socket.<init>(Socket.java:184)

	at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79)

	at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:121)

	at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706)

	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)

	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)

	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)

	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)

	at HttpClientTutorial.main(HttpClientTutorial.java:24)


I am behind proxy but JDeveloper at runtime generates automatically these parameters for me.
-Dhttp.proxyHost=...   -Dhttp.proxyPort=...

So what else could be wrong ? Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Stuck at the start - HTTPClientTutorial won't work

Posted by Roland Weber <ht...@dubioso.net>.
Hi Julius,

> I didn't realize that DNS lookups
> sometimes don't even work without the proxy settings in place!

Without the proxy setting, the target host is resolved on the
client. With the proxy setting, only the proxy host is resolved
on the client, while the target host is resolved on the proxy.
Tricky thing, that :-)

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Stuck at the start - HTTPClientTutorial won't work

Posted by Julius Davies <ju...@cucbc.com>.
Heh - will thank YOU - and Oleg.  I didn't realize that DNS lookups
sometimes don't even work without the proxy settings in place!  I feel
silly for my first email!  :-)

yours,

Julius


On Fri, 2006-22-09 at 07:40 +0200, Ing. Jiří Nejedlý wrote:
> Many thanks, that was the problem.
> After I addded
> 
> HttpClient client = new HttpClient();
>     
> HostConfiguration hcfg = new HostConfiguration();
> hcfg.setProxy("x.x.x.x", port);
> client.setHostConfiguration(hcfg);
> 
> 
> , everything is OK.
> 
> Thanks again.
> 
> >  ------------  Recent mesasage ------------
> >  Od: Oleg Kalnichevski <ol...@apache.org>
> >  Předmět: Re: Stuck at the start - HTTPClientTutorial won't work
> >  Datum: 21.9.2006 17:56:57
> >  ----------------------------------------
> >  On Thu, 2006-09-21 at 16:39 +0200, Ing. Jiří Nejedlý wrote: 
> >  > Hi, 
> >  > I cannot make HTTPClientTutorial work. I use Oracle's JDeveloper 10.1.2. I
> >  added these libraries into my project  - commons-codec-1.3.jar, 
> >  commons-httpclient-3.0.1.jar,  commons-logging-1.1.jar, but it still gives me
> >  this error:
> >  > 
> >  > Fatal transport error: www.apache.org
> >  > 
> >  > java.net.UnknownHostException: www.apache.org
> >  > 
> >  ... 
> >  > 
> >  > I am behind proxy but JDeveloper at runtime generates automatically these
> >  parameters for me.
> >  > -Dhttp.proxyHost=...   -Dhttp.proxyPort=...
> >  > 
> >  > So what else could be wrong ? Thanks.
> >  > 
> >  
> >  Jiří,
> >  
> >  HttpClient does not take into consideration http.proxyHost and
> >  http.proxyPort system properties. You have to make sure that proxy
> >  properties are correctly set up in the HostConfiguration your client is
> >  using
> >  
> >  http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HostConfiguration.html
> >  
> >  Hope this helps
> >  
> >  Oleg
> >  
> >  > ---------------------------------------------------------------------
> >  > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> >  > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >  > 
> >  > 
> >  
> >  
> >  
> >  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
-- 
Julius Davies
Senior Application Developer, Technology Services
Credit Union Central of British Columbia
http://www.cucbc.com/
Tel: 416-652-0183
Cel: 647-232-7571

1441 Creekside Drive
Vancouver, BC
Canada
V6J 4S7


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Stuck at the start - HTTPClientTutorial won't work

Posted by "Ing. Jiří Nejedlý" <ji...@seznam.cz>.
Many thanks, that was the problem.
After I addded

HttpClient client = new HttpClient();
    
HostConfiguration hcfg = new HostConfiguration();
hcfg.setProxy("x.x.x.x", port);
client.setHostConfiguration(hcfg);


, everything is OK.

Thanks again.

>  ------------  Recent mesasage ------------
>  Od: Oleg Kalnichevski <ol...@apache.org>
>  Předmět: Re: Stuck at the start - HTTPClientTutorial won't work
>  Datum: 21.9.2006 17:56:57
>  ----------------------------------------
>  On Thu, 2006-09-21 at 16:39 +0200, Ing. Jiří Nejedlý wrote: 
>  > Hi, 
>  > I cannot make HTTPClientTutorial work. I use Oracle's JDeveloper 10.1.2. I
>  added these libraries into my project  - commons-codec-1.3.jar, 
>  commons-httpclient-3.0.1.jar,  commons-logging-1.1.jar, but it still gives me
>  this error:
>  > 
>  > Fatal transport error: www.apache.org
>  > 
>  > java.net.UnknownHostException: www.apache.org
>  > 
>  ... 
>  > 
>  > I am behind proxy but JDeveloper at runtime generates automatically these
>  parameters for me.
>  > -Dhttp.proxyHost=...   -Dhttp.proxyPort=...
>  > 
>  > So what else could be wrong ? Thanks.
>  > 
>  
>  Jiří,
>  
>  HttpClient does not take into consideration http.proxyHost and
>  http.proxyPort system properties. You have to make sure that proxy
>  properties are correctly set up in the HostConfiguration your client is
>  using
>  
>  http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HostConfiguration.html
>  
>  Hope this helps
>  
>  Oleg
>  
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>  > 
>  > 
>  
>  
>  
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Stuck at the start - HTTPClientTutorial won't work

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2006-09-21 at 16:39 +0200, Ing. Jiří Nejedlý wrote: 
> Hi, 
> I cannot make HTTPClientTutorial work. I use Oracle's JDeveloper 10.1.2. I added these libraries into my project  - commons-codec-1.3.jar,  commons-httpclient-3.0.1.jar,  commons-logging-1.1.jar, but it still gives me this error:
> 
> Fatal transport error: www.apache.org
> 
> java.net.UnknownHostException: www.apache.org
> 
... 
> 
> I am behind proxy but JDeveloper at runtime generates automatically these parameters for me.
> -Dhttp.proxyHost=...   -Dhttp.proxyPort=...
> 
> So what else could be wrong ? Thanks.
> 

Jiří,

HttpClient does not take into consideration http.proxyHost and
http.proxyPort system properties. You have to make sure that proxy
properties are correctly set up in the HostConfiguration your client is
using

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HostConfiguration.html

Hope this helps

Oleg

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Stuck at the start - HTTPClientTutorial won't work

Posted by Doug Lochart <dl...@gmail.com>.
If you know that you are on the network then you may have DNS issues.  Try
an ip address instead or get your DNS issues resolved.

On 9/21/06, Julius Davies <ju...@cucbc.com> wrote:
>
> java.net.UnknownHostException!
>
> >From the machine you are using to work through the tutorial, are you
> even able to do this?
>
> ping www.apache.org
>
>
> It seems like you are not on the internet.  Substitute "www.apache.org"
> with a web server on your own network.
>
> If the web server is not listening on port 80 (or port 443 for "https"),
> be sure to include the port in the URL.
>
>
>
> yours,
>
> Julius
>
>
>
>
> On Thu, 2006-21-09 at 16:39 +0200, Ing. Jiří Nejedlý wrote:
> > Hi,
> > I cannot make HTTPClientTutorial work. I use Oracle's JDeveloper 10.1.2.
> I added these libraries into my project  - commons-codec-1.3.jar,
> commons-httpclient-3.0.1.jar,  commons-logging-1.1.jar, but it still gives
> me this error:
> >
> > Fatal transport error: www.apache.org
> >
> > java.net.UnknownHostException: www.apache.org
> >
> >       at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
> >
> >       at java.net.Socket.connect(Socket.java:452)
> >
> >       at java.net.Socket.connect(Socket.java:402)
> >
> >       at java.net.Socket.<init>(Socket.java:309)
> >
> >       at java.net.Socket.<init>(Socket.java:184)
> >
> >       at
> org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket
> (DefaultProtocolSocketFactory.java:79)
> >
> >       at
> org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket
> (DefaultProtocolSocketFactory.java:121)
> >
> >       at org.apache.commons.httpclient.HttpConnection.open(
> HttpConnection.java:706)
> >
> >       at
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(
> HttpMethodDirector.java:386)
> >
> >       at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(
> HttpMethodDirector.java:170)
> >
> >       at org.apache.commons.httpclient.HttpClient.executeMethod(
> HttpClient.java:396)
> >
> >       at org.apache.commons.httpclient.HttpClient.executeMethod(
> HttpClient.java:324)
> >
> >       at HttpClientTutorial.main(HttpClientTutorial.java:24)
> >
> >
> > I am behind proxy but JDeveloper at runtime generates automatically
> these parameters for me.
> > -Dhttp.proxyHost=...   -Dhttp.proxyPort=...
> >
> > So what else could be wrong ? Thanks.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >
> --
> Julius Davies
> Senior Application Developer, Technology Services
> Credit Union Central of British Columbia
> http://www.cucbc.com/
> Tel: 416-652-0183
> Cel: 647-232-7571
>
> 1441 Creekside Drive
> Vancouver, BC
> Canada
> V6J 4S7
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>


-- 
What profits a man if he gains the whole world yet loses his soul?

Re: Stuck at the start - HTTPClientTutorial won't work

Posted by Julius Davies <ju...@cucbc.com>.
java.net.UnknownHostException!

>>From the machine you are using to work through the tutorial, are you
even able to do this?

ping www.apache.org


It seems like you are not on the internet.  Substitute "www.apache.org"
with a web server on your own network.

If the web server is not listening on port 80 (or port 443 for "https"),
be sure to include the port in the URL.



yours,

Julius




On Thu, 2006-21-09 at 16:39 +0200, Ing. Jiří Nejedlý wrote:
> Hi, 
> I cannot make HTTPClientTutorial work. I use Oracle's JDeveloper 10.1.2. I added these libraries into my project  - commons-codec-1.3.jar,  commons-httpclient-3.0.1.jar,  commons-logging-1.1.jar, but it still gives me this error:
> 
> Fatal transport error: www.apache.org
> 
> java.net.UnknownHostException: www.apache.org
> 
> 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
> 
> 	at java.net.Socket.connect(Socket.java:452)
> 
> 	at java.net.Socket.connect(Socket.java:402)
> 
> 	at java.net.Socket.<init>(Socket.java:309)
> 
> 	at java.net.Socket.<init>(Socket.java:184)
> 
> 	at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79)
> 
> 	at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:121)
> 
> 	at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706)
> 
> 	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)
> 
> 	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
> 
> 	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
> 
> 	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
> 
> 	at HttpClientTutorial.main(HttpClientTutorial.java:24)
> 
> 
> I am behind proxy but JDeveloper at runtime generates automatically these parameters for me.
> -Dhttp.proxyHost=...   -Dhttp.proxyPort=...
> 
> So what else could be wrong ? Thanks.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
-- 
Julius Davies
Senior Application Developer, Technology Services
Credit Union Central of British Columbia
http://www.cucbc.com/
Tel: 416-652-0183
Cel: 647-232-7571

1441 Creekside Drive
Vancouver, BC
Canada
V6J 4S7


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org