0

I am running java cloudant on my local eclipse, i get an error as this.

CloudantClient client = ClientBuilder.account("XXXXXXXX")
.username("XXXXXXXXXX")
.password("YYYYYYYYYYYYYYYY")
.build();

[ERROR ] SRVE0315E: An exception occurred: java.lang.Throwable: java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: com/cloudant/client/api/CloudantClient.(Lcom/cloudant/client/org/lightcouch/CouchDbProperties;Lcom/google/gson/GsonBuilder;)V at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4913) at [internal classes] Caused by: java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: com/cloudant/client/api/CloudantClient.(Lcom/cloudant/client/org/lightcouch/CouchDbProperties;Lcom/google/gson/GsonBuilder;)V at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116) at [internal classes] at ... 1 more Caused by: org.apache.cxf.interceptor.Fault: com/cloudant/client/api/CloudantClient.(Lcom/cloudant/client/org/lightcouch/CouchDbProperties;Lcom/google/gson/GsonBuilder;)V at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:163) ... 4 more Caused by: java.lang.NoSuchMethodError: com/cloudant/client/api/CloudantClient.(Lcom/cloudant/client/org/lightcouch/CouchDbProperties;Lcom/google/gson/GsonBuilder;)V at com.cloudant.client.api.ClientBuilder.build(ClientBuilder.java:269) at at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at com.ibm.ws.jaxrs20.server.LibertyJaxRsServerFactoryBean.performInvocation(LibertyJaxRsServerFactoryBean.java:636) ... 4 more

I am using maven and liberty. Please suggest resolutions.

jmanoj86
  • 7
  • 5

1 Answers1

0

It looks like your versions of CloudantBuilder and CloudantClient are incompatible - the former is calling a constructor on the latter that doesn't exist.

Do you have multiple jars in the application that contain Cloudant classes? In particular, are there multiple jars that contain the same classes? If so, you will need to remove duplicates so that only the desired version of any class is present - Java cannot utilize multiple versions of a class defined by a single class loader, so there's no use case for duplicates.

Jarid
  • 1,878
  • 7
  • 11
  • Hi Jarid, i am using maven for cloudant-client. I updated full error. Can you please suggest how there can be duplicates if maven is used for artifacts. – jmanoj86 May 09 '17 at 06:15
  • I don't know... I don't really have any experience with Maven. NoSuchMethodErrors, though, are pretty straightforward - one class is calling a method the other class doesn't have. It might be worthwhile to see if you can enable verbose class loading to see where each class is coming from. – Jarid May 10 '17 at 11:45