繁体   English   中英

使用reast-easy调用rest服务时的运行时异常

[英]runtime exception while calling rest service using reast-easy

应用程序是Spring 3.1.0,带有EJB绑定和WAS 7部署。

尝试使用以下实现的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);

任何人都可以建议上述问题。

RuntimeDelegateImpl是resteasy-client软件包的一部分。 您需要在pom.xml声明对resteasy-client的依赖性

<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-client</artifactId>
</dependency>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM