【发布时间】:2019-11-06 05:08:42
【问题描述】:
应用程序是带有 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>
调用rest Endpoint的代码:
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);
任何人都可以就上述问题提出建议。
【问题讨论】: