Search code examples
javamongodbkeystorehazelcasthazelcast-imap

Hazelcast - unable to access Mongodb when authorization is enabled due to Certificate issue


I am trying to integrate MongoDB with hazelcast for distributed caching. The MongoDB has cluster servers and requires a password. When i do a get collection call in the MongoMapStore.java class following the example mentioned in

https://github.com/hazelcast/hazelcast-code-samples/blob/master/hazelcast-integration/mongodb/src/main/java/com/hazelcast/loader/MongoMapStore.java. I get errors such as

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: >PKIX path building failed:

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.

etc. If it helps I could produce the entire stacktrace of the errors.

How can I solve this issue.


Solution

  • The error is likely due to a missing Certificate for your DB Server. Ensure your keystore has the required certificate(s). If you do have a the server's public key cert and want to load it, check,

    How to import a .cer certificate into a java keystore?