Jersey client: hk2 UnsatisfiedDependencyException

I'm trying to setup a REST client based on jersey 2. That client code needs to run in a Jetty 9 server (standalone, not embedded) and is supposed to retrieve/consume data from another service. My very basic first test call looks like this:

ClientBuilder.newClient().target("").path("getAll").request().get( String.class )

This call fails with the following error:

Exception in thread "MyApp" MultiException stack 1 of 1 org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=ServiceLocator,parent=JaxbAutoDiscoverable,qualifiers={},position=-1,optional=false,self=false,unqualified=null,186516043) at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve( at org.jvnet.hk2.internal.Utilities.justInject( at org.jvnet.hk2.internal.ServiceLocatorImpl.inject( at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize( at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize( at org.glassfish.jersey.model.internal.CommonConfig.configureAutoDiscoverableProviders( at org.glassfish.jersey.client.ClientConfig$State.configureAutoDiscoverableProviders( at org.glassfish.jersey.client.ClientConfig$State.initRuntime( at org.glassfish.jersey.client.ClientConfig$State.access$000( at org.glassfish.jersey.client.ClientConfig$State$3.get( at org.glassfish.jersey.client.ClientConfig$State$3.get( at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get( at org.glassfish.jersey.client.ClientConfig.getRuntime( at org.glassfish.jersey.client.ClientRequest.getConfiguration( at org.glassfish.jersey.client.JerseyInvocation.validateHttpMethodAndEntity( at org.glassfish.jersey.client.JerseyInvocation.( at org.glassfish.jersey.client.JerseyInvocation.( at org.glassfish.jersey.client.JerseyInvocation.( at org.glassfish.jersey.client.JerseyInvocation$Builder.method( at org.glassfish.jersey.client.JerseyInvocation$Builder.get(

I'm not setting up my environment using Maven - doing it manually. So maybe there is something wrong with the libraries I'm using. Here they are:

Those are way too many by now but I kept adding them as I hoped that the issue would simply be due to a missing jar. It wasn't.

Any help is highly appreciated. Thanks


Thanks to the comments from peeskillet I downloaded the bundle from jersey, removed all the jars that I had previously added to my project, added the required jars out of the bundle (to avoid incompatibilities) and the error was gone. Thanks again!

Need Your Help

Azure GitHub deployment failing with error "Remote 'external' already exists."

git azure github azure-web-sites azure-deployment

I have a repository in GitHub that I've been using as source control for local development.

How to get date picture created in java

java date

I would like to extract the date a jpg file was created. Java has the lastModified method for the File object, but appears to provide no support for extracting the created date from the file. I b...