簡體   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