Hazelcast - 由于证书问题启用授权后无法访问 Mongodb

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

我正在尝试将 MongoDB 与 hazelcast 集成以实现分布式缓存。 MongoDB 有集群服务器,需要密码。当我按照

中提到的示例在 MongoMapStore.java class 中执行 get collection 调用时

https://github.com/hazelcast/hazelcast-code-samples/blob/master/hazelcast-integration/mongodb/src/main/java/com/hazelcast/loader/MongoMapStore.java。我收到诸如

之类的错误

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.

等如果有帮助,我可以生成错误的整个堆栈跟踪。

我该如何解决这个问题。

该错误可能是由于您的数据库服务器缺少证书所致。确保您的密钥库具有所需的证书。如果您确实有服务器的 public 密钥证书并想要加载它,请检查

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