The problem was Norton Firewall.  As soon as I disabled the Norton Firewall
the HTTP communication worked as expected when I launch the application from
the command line 



starrman wrote:
> 
> 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#a12572203
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to