hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: https java.net.SocketException: Socket closed
Date Mon, 15 Nov 2004 20:04:00 GMT
Mark,

Older versions of IBM JSSE shipped with some versions of Websphere are
known to have issues with HttpClient (read, are buggy). Make sure that
you have all the latest Websphere fix packs applied.

For details see the 'Known limitations and problems' section of the
HttpClient SSL guide

http://jakarta.apache.org/commons/httpclient/sslguide.html

Hope this helps

Oleg


On Mon, 2004-11-15 at 19:50 +0000, Mark Benussi wrote:
> I have searched the mail archive and the web for the best part of this 
> afternoon so I am sorry if this has been asked before (Which I am sure it 
> has).
> 
> I am simply trying to use the HttpClient to get https://www.verisign.com but 
> am getting java.net.SocketException: Socket closed when attempting to 
> execute the GetMethod.
> 
> I am doing the following:
> 
> Including the jsse1.0.3_03 libs.
> Dynamically adding a provider - Security.addProvider(new 
> com.sun.net.ssl.internal.ssl.Provider());
> 
> I assume the problem is own to my interaction with jsse.
> 
> Am running this in a WAS 5 Test environment but target environment is Tomcat 
> 5 (If that matters).
> 
> Code is the following.
> 
> String response = null;
> GetMethod getMethod = null;
> try {
> 	// Create a get method instance.
> 	getMethod = new PostMethod(uri);
> 	if (nameValuePairs != null && nameValuePairs.length > 0) {
> 		getMethod.setQueryString(nameValuePairs);
> 	}
> 	getMethod.setFollowRedirects(true);
> 	getMethod.setDoAuthentication(true);
> 
> 	// Create an instance of HttpClient.
> 	HttpClient httpClient = new HttpClient();
> 
> 	// Provide custom retry handler is necessary
> 	DefaultMethodRetryHandler retryhandler =
> 		new DefaultMethodRetryHandler();
> 	retryhandler.setRequestSentRetryEnabled(false);
> 	retryhandler.setRetryCount(3);
> 	getMethod.setMethodRetryHandler(retryhandler);
> 
> 	// Execute the method.
> 	int statusCode = httpClient.executeMethod(httpMethod);
> 	if (statusCode != HttpStatus.SC_OK) {
> 		LogHelper.log(
> 			LogLevel.ERROR,
> 			"Method failed: " + httpMethod.getStatusLine());
> 	}
> 
> 	// Read the response body.
> 	// Deal with the response.
> 	// Use caution: ensure correct character encoding and is not binary data
> 	response = httpMethod.getResponseBodyAsString();
> 
> } catch (URIException urie) {
> 	throw new ApplicationException(urie);
> } catch (HttpException he) {
> 	throw new ApplicationException(he);
> } catch (IOException ioe) {
> 	throw new ApplicationException(ioe);
> } finally {
> 	// Release the connection.
> 	getMethod.releaseConnection();
> }
> // Process the response.
> 
> Your thoughts are appreciated.
> 
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message