hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aljesco <alje...@gmail.com>
Subject HttpClient
Date Tue, 18 Aug 2009 18:01:38 GMT
Hello all!
I'm using HttpClient 4.0 and got some error.
There's code I tested

*****
      DefaultHttpClient httpclient = new DefaultHttpClient();
      HttpGet httpget = new HttpGet("http://yandex.ru");
      HttpResponse response = httpclient.execute(httpget);
      HttpEntity entity = response.getEntity();
      System.out.println("Login form get: " + response.getStatusLine());
      if (entity != null) {
          entity.consumeContent();
      }
      System.out.println("Initial set of cookies:");
      List<Cookie> cookies = httpclient.getCookieStore().
getCookies();
      if (cookies.isEmpty()) {
          System.out.println("None");
      } else {
          for (int i = 0; i < cookies.size(); i++) {
              System.out.println("- " + cookies.get(i).toString());
          }
      }
      httpclient.getConnectionManager().shutdown();
*****

It's working fine in Netbeans 6.5.1 (using java 1.6.0_14) and
httpclient.execute(httpget) works successfully.
In Eclipse 3.4.2 (using java 1.6.0_16) this error is occurried.


*****
18.08.2009 0:21:54 org.apache.http.impl.client.DefaultRequestDirector 
execute
INFO: I/O exception (java.net.SocketException) caught when processing
request: Software caused connection abort: socket write error
18.08.2009 0:21:54 org.apache.http.impl.client.DefaultRequestDirector 
execute
INFO: Retrying request
18.08.2009 0:21:54 org.apache.http.impl.client.DefaultRequestDirector 
execute
INFO: I/O exception (java.net.SocketException) caught when processing
request: Software caused connection abort: socket write error
18.08.2009 0:21:54 org.apache.http.impl.client.DefaultRequestDirector 
execute
INFO: Retrying request
18.08.2009 0:21:54 org.apache.http.impl.client.DefaultRequestDirector 
execute
INFO: I/O exception (java.net.SocketException) caught when processing
request: Software caused connection abort: socket write error
18.08.2009 0:21:54 org.apache.http.impl.client.DefaultRequestDirector 
execute
INFO: Retrying request
Exception in thread "main" java.net.SocketException: Software caused
connection abort: socket write error
  at java.net.SocketOutputStream.socketWrite0(Native Method)
  at java.net.SocketOutputStream.socketWrite(Unknown Source)
  at java.net.SocketOutputStream.write(Unknown Source)
  at 
org.apache.http.impl.io.AbstractSessionOutputBuffer.flushBuffer(AbstractSessionOutputBuffer.java:106)


  at 
org.apache.http.impl.io.AbstractSessionOutputBuffer.flush(AbstractSessionOutputBuffer.java:113)


  at 
org.apache.http.impl.AbstractHttpClientConnection.doFlush(AbstractHttpClientConnection.java:260)


  at 
org.apache.http.impl.SocketHttpClientConnection.close(SocketHttpClientConnection.java:248)


  at 
org.apache.http.impl.conn.DefaultClientConnection.close(DefaultClientConnection.java:154)


  at 
org.apache.http.impl.conn.AbstractPooledConnAdapter.close(AbstractPooledConnAdapter.java:131)


  at 
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:130) 

  at 
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:447)


  at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641) 

  at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576) 

  at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554) 

  at Main.main(Main.java:52)
*****

This error also occurring when I'm trying to launch program using
system JRE (windows xp sp2, JRE 1.6.0_16).

Can anyone help me..?


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


Mime
View raw message