泽西客户端:hk2 UnsatisfiedDependencyException

Jersey client: hk2 UnsatisfiedDependencyException

我正在尝试基于 jersey 2 设置 REST 客户端。该客户端代码需要 运行 在 Jetty 9 服务器(独立的,非嵌入式)中并且应该 retrieve/consume 数据来自另一个服务。 我最基本的第一次测试调用如下所示:

ClientBuilder.newClient().target("https://10.224.1.206:8443/axis/services/EndSystemWebService").path("getAll").request().get( String.class )

此调用失败并出现以下错误:

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[=11=]0(ClientConfig.java:90) at org.glassfish.jersey.client.ClientConfig$State.get(ClientConfig.java:122) at org.glassfish.jersey.client.ClientConfig$State.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)

我没有使用 Maven 设置我的环境 - 手动设置。所以也许我正在使用的库有问题。他们在这里:

现在这些太多了,但我一直在添加它们,因为我希望问题只是因为缺少一个 jar。不是。

非常感谢任何帮助。谢谢

感谢 peeskillet 的评论,我从 jersey 下载了包,删除了我之前添加到项目中的所有 jar,从包中添加了所需的 jar(以避免不兼容)和错误消失了。再次感谢!