Skip to content

Commit 8b9ca45

Browse files
danieljohngomezjyemin
authored andcommitted
Override provider URL when initializing DNS context in case it is defined on classpath
1 parent cd63e16 commit 8b9ca45

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

driver-core/src/main/com/mongodb/internal/dns/DefaultDnsResolver.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public String resolveAdditionalQueryParametersFromTxtRecords(final String host)
146146
private static InitialDirContext createDnsDirContext() {
147147
Hashtable<String, String> envProps = new Hashtable<String, String>();
148148
envProps.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory");
149+
envProps.put(Context.PROVIDER_URL, "dns:");
149150
try {
150151
return new InitialDirContext(envProps);
151152
} catch (NamingException e) {

0 commit comments

Comments
 (0)