For testing I have setup a mongodb server which allows for ssl connections without certificate. I am able to connect in this way using RoboMongo and the mongo-c-driver, however when I try Java I get:
{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}, caused by {sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}, caused by {sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}}
I tried setting the socket factory to use default socket but I get:
com.mongodb.MongoInternalException: SSL is enabled but the socket is not an instance of javax.net.ssl.SSLSocket
How can I make this connection?