java.lang.noclassdeffounderror: org/glassfish/hk2/api/servicelocatorfactory$createpolicy

saivinod picture saivinod · Dec 30, 2015 · Viewed 17k times · Source

Why am I getting error even though I added all the required jars. I am trying to build rest client using JERSEY

client=ClientBuilder.newClient();
response = client.target("https://XXX/rest/api/2/search?jql="+query).request("application/json").header(authorizationHeaderName, authorizationHeaderValue).get();

responseBody = response.readEntity(String.class);
JSONObject jsonObject = new JSONObject(responseBody);
JSONArray jsonArray = jsonObject.getJSONArray("issues");

added jars: JARs

Answer

Maruthi Shanmugam picture Maruthi Shanmugam · Dec 30, 2015

ServiceLocatorFactory$createPolicy is part of the hk2-api 2.4.* and above. You are using a lower version of hk2-api.

Thanks