1
我有一個運行在WildFly 10上的Java EE應用程序。此應用程序使用Jersey並且在使用REST客戶端測試時運行良好。使用JUnit和Jersey客戶端測試JAX-RS應用程序
我寫了一個JUnit測試,它使用Jersey Client API向上述應用程序發出請求。當我運行它,我得到如下:
javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.handleErrorStatus(ClientInvocation.java:209)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:174)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:473)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder.get(ClientInvocationBuilder.java:165)
在跟蹤下一行引用下面的request()
電話:
@Test
public void test() {
Client client = ClientBuilder.newClient();
WebTarget target = client.target("http://localhost:8080/myapp/webapi");
target.path("/users");
String response = target.request("application/json").get(String.class);
assertEquals("test", response);
}
任何想法?
它說埃羅r在服務器端不在客戶端,很可能你沒有將所有必需的參數傳遞給服務器 – hoaz