应用程序是带有EJB绑定和WAS 7部署的Spring 3.1.0。
尝试使用具有以下实现的resteasy-jaxrs和jaxrs-api jar调用Rest Service端点。但是无法调用端点,出现如下所示的RunTimeException:
java.lang.RuntimeException:java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
原因:java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
pom中使用的依赖项是
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
呼叫休息端点的代码:
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpParams params = httpClient.getParams();
String serviceTimeout = "180000";
HttpConnectionParams.setConnectionTimeout(params,
Integer.parseInt(serviceTimeout));
HttpConnectionParams.setSoTimeout(params,
Integer.parseInt(serviceTimeout));
ClientExecutor clientExecutor = new
ApacheHttpClient4Executor(httpClient);
ClientRequest clientRequest = new ClientRequest("url",
clientExecutor);
clientRequest.body(MediaType.APPLICATION_XML, xml);
logger.debug("Sending request :");
ClientResponse<String> clientResponse =
clientRequest.post(String.class);
任何人都可以就上述问题提出建议。
答案 0 :(得分:0)
RuntimeDelegateImpl
是resteasy-client软件包的一部分。您需要在pom.xml
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
</dependency>