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("https://10.224.1.206:8443/axis/services/EndSystemWebService").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(ThreeThirtyResolver.java:75) at org.jvnet.hk2.internal.Utilities.justInject(Utilities.java:945) at org.jvnet.hk2.internal.ServiceLocatorImpl.inject(ServiceLocatorImpl.java:980) at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1055) at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1046) at org.glassfish.jersey.model.internal.CommonConfig.configureAutoDiscoverableProviders(CommonConfig.java:608) at org.glassfish.jersey.client.ClientConfig$State.configureAutoDiscoverableProviders(ClientConfig.java:364) at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:399) at org.glassfish.jersey.client.ClientConfig$State.access$000(ClientConfig.java:90) at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:122) at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:119) at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:340) at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:733) at org.glassfish.jersey.client.ClientRequest.getConfiguration(ClientRequest.java:285) at org.glassfish.jersey.client.JerseyInvocation.validateHttpMethodAndEntity(JerseyInvocation.java:135) at org.glassfish.jersey.client.JerseyInvocation.(JerseyInvocation.java:105) at org.glassfish.jersey.client.JerseyInvocation.(JerseyInvocation.java:101) at org.glassfish.jersey.client.JerseyInvocation.(JerseyInvocation.java:92) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:420) at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:316)

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

Answers


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...