I am encountering the error: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder however i have imported the classes so am not sure why it is popping up. My build.gradle and code is below:
private String getAccessToken() {
try {
Log.e("tree","get access entered");
javax.ws.rs.client.Client client = javax.ws.rs.client.ClientBuilder.newClient();
javax.ws.rs.client.Entity<String> payload =
javax.ws.rs.client.Entity.text("grant_type=client_credentials&redirect_uri=https://facebook.com/__");
javax.ws.rs.core.Response response = client.target("https://v2.api.xapo.com/oauth2/token")
.request(MediaType.TEXT_PLAIN_TYPE)
.header("Authorization","Basic ___")
.post(payload);
Log.e("tree","response completed");
String body = response.readEntity(String.class);
Log.e("tree","body "+body);
} catch(Exception e) {
Log.e("tree","token exception "+e.getMessage());
}
return "";
}
You are missing the org.glassfish.jersey.core:jersey-client
dependency.
If you are using pom.xml
, add the Maven dependency below in your pom.xml
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.2.Final</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With