hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Price <epr...@camsys.com>
Subject Operation timed out: connect:could be due to invalid address
Date Thu, 22 Jun 2006 14:40:38 GMT
Hi,

We have integrated the HttpClient library into our application, where it 
is used to issue simple POST requests via HTTPS to a remote server and 
processes the response.  Our use of this library is not very 
significant, I have pasted into this email the extent of our usage to 
give you an indication of the fact that we are not doing anything 
complicated (see below).

The application works perfectly when running on Tomcat 5.0.x, and then 
in our QA environment on WebSphere 5.1.  However, when we give the EAR 
file to our customer for deployment (onto a machine to which we have no 
access, they do the deployment), it seems that everything works except 
for the component that makes use of HttpClient.  When the HTTP request 
is issued by our code, we find this message in the WebSphere logs:

[6/21/06 11:21:55:467 EDT] 215da05f SystemOut     O 2006-06-21 
11:21:55,452 DEBUG [Servlet.Engine.Transports : 0] 
httpclient.HttpMethodDirector (HttpMethodDirector.java:442)     - 
Operation timed out: connect:could be due to invalid address
java.net.SocketException: Operation timed out: connect:could be due to 
invalid address

We have ruled out the possibility that the customer's server is unable 
to access the remote server by asking our customer to issue a POST 
request using a web browser from the server machine -- the response was 
successful.

We are directing the "httpclient.wire" logger output to a FileAppender 
in our log4j.properties.  In our development and QA environments, this 
file is full of log messages from HttpClient.  However, in our 
customer's deployment, this is an empty file.

Has anyone seen this symptom before?  Absolutely *zero* log data from 
the "httpclient.wire" loggers, not even a connection attempt?  Can 
anyone give any ideas as to what might have led to this situation?  
Remember, everything seems to work under Tomcat 5.0.x and a different 
WebSphere 5.1, so it does not appear to be a problem in our code or with 
the remote server.

Thanks in advance,

Erik


Here is the extent of what we are doing with HttpClient, I have added 
comments specific to this email with "//+++":

        HttpClientParams httpClientParams = new HttpClientParams();
        httpClientParams.setSoTimeout(HTTP_SOCKET_TIMEOUT_MILLIS);
        //+++ HTTP_SOCKET_TIMEOUT_MILLIS is set to 60000
        HttpClient client = new HttpClient(httpClientParams);

        PostMethod post = new PostMethod(targetUrl);
        //+++ targetUrl is the https:// URL we are accessing
        post.addParameters(parameters);
        //+++ parameters is a NameValuePair[] with about eight variables

        try {
            int responseCode = client.executeMethod(post);
            //+++ according to our analysis, the above line throws the 
exception
            if (HttpStatus.SC_OK != responseCode) {
                throw new Exception("Expected response " + 
HttpStatus.SC_OK + " from URL '" + targetUrl + "' but got '" + 
responseCode + "'");
            }
            setLastResponseBody(post.getResponseBodyAsString());
        }
        catch (Exception e) {
            LOG.error(e);
            setLastResponseBody(null);
        }
        finally {
            try {
                post.releaseConnection();
            }
            catch (Exception e) {
                // can't do much if this happens
            }
        }



---------------------------------------------------------------------
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