NoSuchMethodError thrown by ViewConnection, when i am trying to create a Couchbase Connection

I am using couchbase-client-1.4.1.jar to write the documents into Couchbase Server

Application thrown the following exception when i am trying to create a couchbase connection running through Websphere application server. When i run through standalone (with main), it works fine. But seen the issue only run through Websphere Message Driven Beans.

java.lang.NoSuchMethodError: org/apache/http/protocol/RequestUserAgent.(Ljava/lang/String;)V
at com.couchbase.client.ViewConnection.(
at com.couchbase.client.CouchbaseConnectionFactory.createViewConnection(
at com.couchbase.client.CouchbaseClient.(
at com.couchbase.client.CouchbaseClient.(

I got the same issue with 1.4.4 in my Spark application. Moved back to 1.2.1 and it works.

I’m pretty sure you are running into a class loader /classpath issue, which is not be particular to the Couchbase SDK. Or maybe try to clean out the cache and so forth to make sure nothing stale is lurking around?

I’m not sure how to provide more advice, maybe we can move it forward if you provide more context.

Hey, I am facing the same issue with WAS 8.5. I am not sure and I am definitely sure its not build path issue as I created the simple maven project and copied the libraries from there, so there is no matter of missing any library.

I also created a question here.

Please let me know if you have any solution to this.

Thanks in advance.

hey @apeshave,
I see basically two options here:

  • either you stick with an even older version of the SDK in order to have a dependency on the same version of apache http jars than WAS (which would hold you back to a point in time where you miss on about 1 year and a halt of improvements, not what I would recommend)
  • or you have to use the newest of the 2.x generation, which uses netty and has most dependencies except rxjava packaged in as a fat jar (less likely to have classpath conflicts, but different api and paradigms, as reflected in the fact that the maven artifact has been renamed to java-client)

I’m actually doing as @apeshave is advising: using the other client makes my impl work.

Going back to this topic, I’m thinking that from my WAS deployed application I’m using Couchbase resources that are actually external to WAS and should be handled in a controlled way (Sockets, threads too ?). To do this properly would it be better to implement a JCA compliant resource adapter so that the Document database resources are exposed to J2EE applications in a more appropriate way ? I gave a look also to the JDB/ODBC driver for Couchbase in order to create a DS that applications in the app server may use as other DS, but that is still in beta. According to what the Cbase client resources are doing, a JCA connector may be more appropriate. I didn’t dig into the client sources to try to understand what’s happening in there (if threads are started they should not be started in an app without being under AS control… to make an example). So just asking to the experts.