-
Type:
Improvement
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
If one were to take the Java example provided and run it, you'll be greeted by a ~100 line-long exception chain at runtime.
Relevant snippet:
... Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target ...
Essentially the example glosses over the required steps to import and use a custom Java trustStore (and potentially the trustStore password) that contains the MongoDB server certificate. These steps are approximately discussed in this mongodb-user comment. (Although I believe the keystore usage may have been unnecessary - I'm not certain myself.)
(Note: it is possible that this example could work as is, but only in the case where the user starts their MongoDB node using a certificate that's been signed by a trusted 3rd party, e.g., Verisign, which are already bundled within the default JRE. However I suspect this usage would be exceedingly rare in practice.)