driver-core/src/main/com/mongodb/internal/dns/DefaultDnsResolver.java
private static InitialDirContext createDnsDirContext() {
        Hashtable<String, String> envProps = new Hashtable<String, String>();
        envProps.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory");
        try {
            return new InitialDirContext(envProps);
        } catch (NamingException e) {
            throw new MongoClientException("Unable to support mongodb+srv// style connections as the 'com.sun.jndi.dns.DnsContextFactory' "
                    + "class is not available in this JRE. A JNDI context is required for resolving SRV records.", e);
        }
    }
private static InitialDirContext createDnsDirContext() {
        Hashtable<String, String> envProps = new Hashtable<String, String>();
        envProps.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory");
        try {
            return new InitialDirContext(envProps);
        } catch (NamingException e) {
            throw new MongoClientException("Unable to support mongodb+srv// style connections as the 'com.sun.jndi.dns.DnsContextFactory' "
                    + "class is not available in this JRE. A JNDI context is required for resolving SRV records.", e);
        }
    }
/*
It's unfortunate that we take a runtime dependency on com.sun.jndi.dns.DnsContextFactory.
This is not guaranteed to work on all JVMs but in practice is expected to work on most.