When i try to connect to MongoDB i get this error:
exception={com.mongodb.MongoSocketException: xxxxxxx}, caused by {java.net.UnknownHostException: xxxxxxx}}]"
The java code:
MongoClientURI mangoUri = new MongoClientURI("mongodb://user:pwd@xxxxxxx:27017/?authSource=admin&authMechanism=SCRAM-SHA-1&allowConnectionsWithoutCertificates=true&sslInvalidHostnameAllowed=true");
MongoClientOptions options = MongoClientOptions.builder().sslInvalidHostNameAllowed(true).build();
MongoClient mongoClient = new MongoClient("user:27017",options) ;
mongoDatabase =mongoClient.getDatabase("test");
MongoIterable<String> documents = mongoDatabase.listCollectionNames();
System.out.println(documents.first());
MongoCollection<Document> collection = mongoDatabase.getCollection("event_cidb");
Document searchedfields=collection.find(eq("customer_id","4545454545454")).first();
System.out.println(searchedfields);
mongoClient.close();
However in the tool compass mongodb I can connect to it:
I had to disable ssl (in java code)