0

I am trying to build a async REST client but getting following error in IBM WebSphere 8.5, java.lang.RuntimeException: java.lang.NoClassDefFoundError: javax/ws/rs/client/ClientBuilder

While building ClientBuilder object. I tried to search everywhere but solution is provided for other application servers not for IBM WebSphere. When I decompiled ClientBuilder class it expect the property JAXRS_DEFAULT_CLIENT_BUILDER = "org.glassfish.jersey.client.JerseyClientBuilder";

but what is the value of implementation class/property for WebSphere?

Code I am trying to run,

ClientBuilder cb = ClientBuilder.newBuilder();   // Exception occurs at this line
Client client =   cb.build(); 
WebTarget target  = client.target(URL);
Future<Response> future = target.request(MediaType.APPLICATION_XML).async().
post(Entity.entity(notifications, MediaType.APPLICATION_XML));
Response response  = future.get(5, TimeUnit.SECONDS);
if(response.getStatus() == SUCCESS) {
        respStatus = SUCCESS;
}

Am I missing some configuration? or property setting?

Note: I have added javax.ws.rs-api-2.0-m10.jar on classpath.

0

1 Answer 1

2

WebSphere provides jaxrs-1.1 implementation based on Wink, so they will conflict with library you provided. You will either need to disable default implementation and use your own, or create Wink client.

Check these posts:

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @Gas. I rewrote client with Apache Wink as we have multiple applications deployed on single server. Configruation changes in server will impact other applications as well so went with Wink approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.