Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2933

Mongo DB Java Driver SSL

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 3.5.0
    • Configuration
    • None

    Description

      Hi Team,

      I am looking for help for SSL connection to mongo db through Java driver.

      I am able to connect to Mongo with SSL using key and cert and steps mentioned in mongodb documentation.

       

      JVM properties

                  System.setProperty("javax.net.ssl.trustStore", <keystorePath>);

                  System.setProperty("javax.net.ssl.trustStorePassword", <*******>);

                  System.setProperty("javax.net.ssl.trustStoreType", "JKS");

       

                  System.setProperty("javax.net.ssl.keyStore", <keystorePath>);

                  System.setProperty("javax.net.ssl.keyStorePassword", <*******>);

                  System.setProperty("javax.net.ssl.keyStoreType", "JKS");

      options = MongoClientOptions.builder().codecRegistry(codecRegistry).connectionsPerHost(100)

                              .connectTimeout(5000).readPreference(ReadPreference.primary())

                              .threadsAllowedToBlockForConnectionMultiplier(10).maxConnectionIdleTime(600000).sslEnabled(true)

                              .sslInvalidHostNameAllowed(true).build();

       

      But I am facing other problems with it, I have other functionality dependent on different certificate not working, seems setting above system property overwritten JVM cert keystore with mongodb certificate, So only mongo SSL is working, all other functionality need SSL connection failing.

      Is this correct understanding or I am doing wrong. In case its overwriting what should be the solution.

       

      Thanks,

      Siddharth Mehta

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            simehta@cisco.com Siddharth Mehta
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: