简体   繁体   中英

runtime exception while calling rest service using reast-easy

Application is Spring 3.1.0 with EJB binding and WAS 7 deployment.

Trying to call Rest Service endpoint using resteasy-jaxrs and jaxrs-api jars with below implementation. But unable to call the endpoint, getting RunTimeException as below:

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

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

dependencies used in pom are

<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. You'll need to declare a depedency to resteasy-client in your pom.xml

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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