Skip to content

ClientEncryptions.create throws ClassNotFoundException #4853

@mcveighc

Description

@mcveighc

Currently my project is setup to use spring-boot 3.3 and has a maven dependency for mongoCrypt v1.8.0

When i attempt to upgrade mongoCrypt to 5.2.0 with spring-boot 3.3, or i upgrade to spring-boot 3.4 i see the follow exception thrown when trying to create a ClientEncryption bean.

Heres my code:

  @Bean
  public ClientEncryption mongoClientEncryption(final AwsCredentialsProvider environmentVariableCredentialProvider) {
    final MongoClientSettings kvmcs = MongoClientSettings.builder()
        .applyConnectionString(new ConnectionString(connectionString))
        .build();

    final ClientEncryptionSettings ces = ClientEncryptionSettings.builder()
        .keyVaultMongoClientSettings(kvmcs)
        .keyVaultNamespace(keyVaultNamespace)
        .kmsProviders(
            mongoConfigurationHelper.getKmsProvider(kmsProvider))
        .kmsProviderPropertySuppliers(
            mongoConfigurationHelper.getKmsProviderSuppliers(environmentVariableCredentialProvider))
        .build();

    return ClientEncryptions.create(ces);
  }

Base exception thrown when calling ClientEncryptions.create(ces)

java.lang.ClassNotFoundException: com.mongodb.crypt.capi.MongoCryptOptions

Bubbles up to an org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name...

Having done a little digging it appears the MongoCryptOptions class no longer exists in the libmongocrypt project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions