我如何解决这个问题:javax.ws.rs.NotFoundException:HTTP 404 Resource_not_found

时间:2017-03-08 14:13:06

标签: jersey jax-rs

我试图通过JAX-RS变得更加熟悉,这是我的代码片段

WebTarget target; // this object reference was created successfully 

 public Client[] getClients() {
        return target.request().get(Client[].class); // NOTE target is not null
}

这是记录的例外

Caused by: javax.ws.rs.NotFoundException: HTTP 404 Resource_not_found
    at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:945)
    at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:784)
    at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:91)
    at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:672)
    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:424)
    at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:668)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:397)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:297)
    at org.business.bee.client.ClientBean.getClients(ClientBean.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

1 个答案:

答案 0 :(得分:0)

如果在getter中抛出错误,您将在处理RENDER_RESPONSE 6" _或类似过程中遇到_"致命:JSF1073:javax.el.E​​LException。底层(真实!)错误与jsf,ejb,jstl或facelets无关。只需确保不会发生以下异常(抛出您的代码尝试访问休息服务):

  javax.ws.rs.NotFoundException: HTTP 404 Resource_not_found