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 Oleg Kalnichevski <ol...@apache.org> on 2010/01/30 23:46:57 UTC

RE: org.apache.http.conn.HttpHostConnectException: Connection to http://server.name.com refused

On Fri, 2010-01-29 at 16:25 -0800, Razvan Mihailescu-Baltag wrote:
> We don't use any special proxy for the java applications and for other 
> applications.
> 
> Bellow is a request being made to the public url:
> 
> wget http://server.name.com/directory
> --00:09:23--  http://server.name.com/directory
>            => `directory'
> Resolving server.name.com... server.ip.address
> Connecting to server.name.com:80... connected.
> HTTP request sent, awaiting response... 301 Moved Permanently
> Location: http://server.ip.address/directory/ [following]
> --00:09:23--  http://server.ip.address/directory/
>            => `index.html'
> Reusing existing connection to server.ip.address:80.
> HTTP request sent, awaiting response... 200 OK
> Length: 44 [text/html]
> index.html: Permission denied
> 
> Next, the request being made to the private url:
> 
> wget http://server.name.com
> --00:14:08--  http://server.name.com/
>            => `index.html'
> Resolving server.name.com... server.ip.address
> Connecting to server.name.com |server.ip.address|:80... connected.
> HTTP request sent, awaiting response... 403 Forbidden
> 00:14:08 ERROR 403: Forbidden.
> 
> My understanding here is that we have basic connectivity to the server. Wget 
> is able to establish a connection to the server, but it seems that http client 
> throws an exception at 
> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:127).
> 
> Unfortunatelly, on the machine where my java application runs I cannot install 
> any other applications and only have wget and curl tools.
> 
> 

The root exception is thrown by the java.net.PlainSocketImpl class. This
is a local connectivity problem, which has nothing to do with
HttpClient. The target host is either not accessible or the timeout
value is too aggressive. 

> >
> > Caused by: java.net.ConnectException: Connection timed out
> >
> >         at java.net.PlainSocketImpl.socketConnect(Native Method)
> >
> >         at java.net.PlainSocketImpl.doConnect(Unknown Source)
> >
> >         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> >
> >         at java.net.PlainSocketImpl.connect(Unknown Source)
> >
> >         at java.net.SocksSocketImpl.connect(Unknown Source)
> >
> >         at java.net.Socket.connect(Unknown Source)
> >
> >         at
> >
> org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFa
> ctory.java:123)
> >
> >         at
> >
> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(D
> efaultClientConnectionOperator.java:123)
> >
> 

The fact that you can access the target host from _another_ machine is
meaningless.

Oleg


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