hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From starrman <sta...@gmail.com>
Subject Desktop App attempting to communicate with Web App using HttpClient... Receiving UnknownHostException
Date Sat, 08 Sep 2007 18:06:00 GMT

I have a Java Swing app (desktop app) that is attempting to communicate with
a website using HttpClient. When I run this app from within the IDE the HTTP
communications works flawlessly. When I attempt to run the app from the
command line the HTTP communication fails with a
java.net.UnknownHostException

Any Ideas?

Here is the code snippet:

                        String googleUrl = "http://www.google.com/";
			HttpClient client = new HttpClient();
			GetMethod get = new GetMethod(googleUrl);

			int iGetResultCode = client.executeMethod(get);
			final String strGetResponseBody = get.getResponseBodyAsString();

Here is the Exception I am seeing...

java.net.UnknownHostException: www.google.com
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
        at
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
        at
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
        at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
        at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
-- 
View this message in context: http://www.nabble.com/Desktop-App-attempting-to-communicate-with-Web-App-using-HttpClient...-Receiving-UnknownHostException-tf4406763.html#a12572121
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Mime
View raw message