获得javax.ws.rs.ProcessingException:javax.ws.rs.core.Response $ Status $ Family.familyOf(I)Ljavax / ws / rs / core / Response $ Status $ Family;

时间:2018-12-05 08:37:56

标签: java jersey-2.0

我下面的代码给出以下异常:

  

获取javax.ws.rs.ProcessingException:javax.ws.rs.core.Response $ Status $ Family.familyOf(I)Ljavax / ws / rs / rs / core / Response $ Status $ Family;

代码段:

private static void getResponse(SomeRequest someRequest) {
    try {
        Client client = ClientBuilder.newClient();
        WebTarget webTarget = client.target("some end-point");

        Invocation.Builder invocationBuilder = webTarget.request();
        Response response = invocationBuilder.post(Entity.entity(someRequest, MediaType.APPLICATION_JSON));

        System.out.println(response.getStatus());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

例外:

javax.ws.rs.ProcessingException: javax.ws.rs.core.Response$Status$Family.familyOf(I)Ljavax/ws/rs/core/Response$Status$Family;
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:236)
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:655)
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:652)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:422)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:652)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:412)
at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:321)
at com.wu.consumer.client.AtlasServiceClient.getResponse(SomeServiceClient.java:57)
Caused by: java.lang.NoSuchMethodError: javax.ws.rs.core.Response$Status$Family.familyOf(I)Ljavax/ws/rs/core/Response$Status$Family;
at org.glassfish.jersey.message.internal.Statuses$StatusImpl.<init>(Statuses.java:63)
at org.glassfish.jersey.message.internal.Statuses$StatusImpl.<init>(Statuses.java:54)
at org.glassfish.jersey.message.internal.Statuses.from(Statuses.java:93)
at org.glassfish.jersey.client.HttpUrlConnector._apply(HttpUrlConnector.java:278)
at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:182)
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:227)
... 11 more

请帮助解决此问题。

0 个答案:

没有答案