Get DNS SRV record using JNDI
问题 I am trying to get SRV records from a DNS server using JNDI. Hashtable<String, String> env = new Hashtable<String, String>(); env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory"); env.put("java.naming.provider.url", "dns://dns.server.com"); DirContext ctx = new InitialDirContext(env); Attributes attributes = ctx.getAttributes("_sip._udp", new String [] { "SRV" }); return attributes; But when trying to get attributes I get the following exception DNS error [Root