简体   繁体   English

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

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

Application is Spring 3.1.0 with EJB binding and WAS 7 deployment. 应用程序是Spring 3.1.0,带有EJB绑定和WAS 7部署。

Trying to call Rest Service endpoint using resteasy-jaxrs and jaxrs-api jars with below implementation. 尝试使用以下实现的resteasy-jaxrs和jaxrs-api jar调用Rest Service端点。 But unable to call the endpoint, getting RunTimeException as below: 但无法调用端点,如下所示获取RunTimeException:

java.lang.RuntimeException: java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl java.lang.RuntimeException:java.lang.ClassNotFoundException:com.sun.ws.rs.ext.RuntimeDelegateImpl

Caused by: java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl 引起:java.lang.ClassNotFoundException:com.sun.ws.rs.ext.RuntimeDelegateImpl

dependencies used in pom are pom中使用的依赖关系是

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

Code to call 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);

Can anyone suggest on above issue. 任何人都可以建议上述问题。

RuntimeDelegateImpl is part of the resteasy-client package. RuntimeDelegateImpl是resteasy-client软件包的一部分。 You'll need to declare a depedency to resteasy-client in your pom.xml 您需要在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