ava.lang.NoClassDefFoundError: Unable to load class com.couchbase.client.java.env.CouchbaseEnvironment due to missing dependency com/couchbase/client/encryption/CryptoManager

Running the Java client in Jenkins/Groovy and was using 2.5.7. A simple upgrade to 2.7.4 (no other changes) resulted in:

ava.lang.NoClassDefFoundError: Unable to load class com.couchbase.client.java.env.CouchbaseEnvironment due to missing dependency com/couchbase/client/encryption/CryptoManager

Found some info on stack overflow:

https://docs.couchbase.com/c-sdk/2.10/encryption.html indicates that this is:
Field Level Encryption for all SDKs is a separate package from the Couchbase SDK itself; the APIs are extensions of the SDK, but the SDK does not have a dependency on FLE. This means you can install the relevant SDK without being dependant upon a suite of crypto libraries.

But… I’m not actively using this…

Thanks - H

Hi unhuman,

Oops, sorry about that. My guess is Groovy is inspecting the DefaultCouchbaseEnvironment (or some other class that interacts with the crypto extension) in a way that triggers the “class not found” issue. Short term, yeah, the workaround is to include the “optional” dependency:

<dependency>
  <groupId>com.couchbase.client</groupId>
  <artifactId>encryption</artifactId>
  <version>1.0.0</version>
</dependency>

I filed JCBC-1333 and added you as a watcher.

Thanks,
David

1 Like