How to turn of SSL/TLS validation with property or VM option with java?

1.1k views Asked by At

I am trying to connect to a local cosmosdb runing the cosmosdb emulator in a windows VM. I have successfully created the port forwarding and can call it from my nodejs script. However I need to get this working with java and there are no docs on this website for this local cosmos instructions. I have seen java examples that show how to programatically ignore TLS/SSL validation however I would prefer JVM or property file option. The reason for this is that I only want this to occur locally for developers and not at all be in dev or prod. This is the error that I am getting:

javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Is there a way to add a property to property file or JVM option to turn off SSL/TLS validation? If so what is it? Other options aside from programmatic would be appreciated. Thanks.

1

There are 1 answers

2
Andrei Kovrov On

I'm afraid isn't possible by adding some JVM property. If you don't want to configure it programmatically you need to add the root CosmosDB certificate to your JVM truststore on your dev server.