Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Failing to connect with v9.2.2 HttpClient

I am having issues using Jetty HttpClient after upgrading from v9.0.4 to v9.2.2.

I using RHEL 5.10 on a Dell Server.  uname -r outputs: 2.6.18-371.8.1.el5
The machine does not have support for IPv6.
I am using Oracle Java 7u60 JRE.

When using v9.2.2 Jetty JARs, I did not see any connection attempt made to the destination. Running tcpdump confirmed this. After running strace on my test program[1], I found that the socket syscall is failing with 9.2.2 with PF_INET6 and not retrying with PF_INET. With v9.0.4, it retries with PF_INET and is successful.

strace -f output using v9.0.4:
socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = -1 EAFNOSUPPORT (Address family not supported by protocol)
#then later...
#Afterwards the connect syscall was successful, and request/response was successful

strace -f output using v9.2.2:
socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = -1 EAFNOSUPPORT (Address family not supported by protocol)
# no attempt at socket(PF_INET, ...)

Additionally, I tried running the program with, but with the v9.2.2 JARs it still attempted to create the socket with PF_INET6. I am able to run a Jetty Servlet with v9.2.2 on the same machine without any issues.
I also tried v9.1.5, and had the same results as with v9.2.2

Any help would be appreciated.

// Using jetty-client, jetty-http, jetty-util, and jetty-io JARs
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.Response;
import org.eclipse.jetty.client.api.Result;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.util.BufferingResponseListener;

public class Test {
    public static void main(String[] args) {
        HttpClient jettyHttpClient = new HttpClient();
final ExecutorService executorService = Executors.newFixedThreadPool(10);
        try {
String url = "";; //Change this to valid server
            Request jettyClientRequest = jettyHttpClient.newRequest(url);
            jettyClientRequest.timeout(30000, TimeUnit.MILLISECONDS);
                new BufferingResponseListener(500 * 1024 * 1024)
                    public void onComplete(Result reqResult) {
                        String responseBody = getContentAsString();
                        Response response = reqResult.getResponse();
System.out.println("Status code: " + response.getStatus());
        } catch (final Exception e) {
            System.out.println("Caught exception" + e);

Back to the top