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.

Gas
  • 17,601
  • 4
  • 46
  • 93
SandyStack
  • 13
  • 1
  • 4

1 Answers1

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:

Community
  • 1
  • 1
Gas
  • 17,601
  • 4
  • 46
  • 93
  • 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. – SandyStack Dec 03 '14 at 20:05