From 78ee22c2611ee49c989092d9686d521b719df88a Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 2 Mar 2019 14:42:19 +0100 Subject: [PATCH] Revert "Do not set com.sun.jndi.dns.DnsContextFactory in JavaxResolver" This reverts commit ac9641f09187ae4a393c5f1acb1e94e66f24a64f. Reverted because now an NoInitialContextException is now thrown. Related to SMACK-856. --- .../jivesoftware/smack/util/dns/javax/JavaxResolver.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java b/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java index e83c588f6..58da92432 100644 --- a/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java +++ b/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java @@ -1,6 +1,6 @@ /** * - * Copyright 2013-2019 Florian Schmaus + * Copyright 2013-2018 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.jivesoftware.smack.util.dns.javax; import java.net.InetAddress; import java.util.ArrayList; +import java.util.Hashtable; import java.util.List; import java.util.logging.Level; @@ -51,7 +52,9 @@ public class JavaxResolver extends DNSResolver implements SmackInitializer { static { try { - dirContext = new InitialDirContext(); + Hashtable env = new Hashtable<>(); + env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory"); + dirContext = new InitialDirContext(env); } catch (NamingException e) { LOGGER.log(Level.SEVERE, "Could not construct InitialDirContext", e); }