On Fri, 2008-08-22 at 06:15 -0700, talldean wrote:
> Hopefully this is a less useless question than my last one.
>
> I have two projects using GetMethod. Both are connecting to the same https:
> website. One, however, is returning the following:
>
> java.net.SocketException: Unconnected sockets not implemented
> at javax.net.SocketFactory.createSocket(SocketFactory.java:2)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:615)
> at
> org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:116)
>
This is bizarre. What JRE are you using?
Anyways you can work this problem around by disabling connect timeout:
params.setConnectionTimeout(0);
Oleg
> Searching around, this appears related to SSL, but that's all I've got.
> Both projects are the same, as near as I can tell. Both have a matching
> copy of a Java Keystore that I created to accept the self signed cert on the
> site. Both set the truststore to be that Keystore:
>
> System.setProperty("javax.net.ssl.trustStore", "test/jssecacerts");
>
> The code being called is as follows:
>
> public final String httpGet(String urlString, int timeout) {
> HttpClient client = buildHttpClient(timeout);
> GetMethod method = new GetMethod(urlString);
> try {
> int statusCode = client.executeMethod(method);
> if (statusCode != -1) {
> String result =
> method.getResponseBodyAsString();
> method.releaseConnection();
> return result;
> }
> } catch (IOException ioe) {
> logger.error("Error executing HTTP GET", ioe);
> }
>
> return null;
> }
>
> private HttpClient buildHttpClient(int timeout) {
> HttpClient client = new HttpClient();
> HttpConnectionManager manager =
> client.getHttpConnectionManager();
> HttpConnectionParams params = manager.getParams();
> params.setConnectionTimeout(timeout);
> return client;
> }
>
> Any ideas where I've gone wrong?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]