Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClientBuilder class not found

I am trying to build a RESTFul client using Jersey framework, so I added the following class:

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

public class ActivityClient {
    private Client client;  
    public ActivityClient(){        
        client = ClientBuilder.newClient();
    }   
        //...code
}

but I am getting an error class ClientBuilder not found, even though I have the following jars under WEB-INF/lib and under the application class path:

asm-3.1.jar
jackson-core-asl-1.9.2.jar
jackson-jaxrs-1.9.2.jar
jackson-mapper-asl-1.9.2.jar
jackson-xc-1.9.2.jar
jersey-client-1.17.1.jar
jersey-core-1.17.1.jar
jersey-json-1.17.1.jar
jersey-server-1.17.1.jar
jersey-servlet-1.17.1.jar
jettison-1.1.jar
jsr311-api-1.1.1.jar

So can someone please tell me which jar I am missing here? and where I can find it? I have searched the web and the only jar I found that has ClientBuilder is related to the RESTEasy framework, so I don't think that it is related.

Thanks for your time

like image 734
MChan Avatar asked Dec 24 '13 15:12

MChan


1 Answers

As far as I can see, ClientBuilder is part of the Jersey 2.x API, and you are using Jersey 1.17.1. So either use a new version, or use the 1.17.1 API which can be found here

like image 167
NickL Avatar answered Oct 07 '22 00:10

NickL