Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 213E91794C for ; Fri, 20 Mar 2015 06:32:55 +0000 (UTC) Received: (qmail 46058 invoked by uid 500); 20 Mar 2015 06:32:39 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 45909 invoked by uid 500); 20 Mar 2015 06:32:39 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 45766 invoked by uid 99); 20 Mar 2015 06:32:39 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Mar 2015 06:32:39 +0000 Date: Fri, 20 Mar 2015 06:32:39 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-8520) Camel XMPP doesn't use a DNS resolver to look at SRV records MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-8520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14370841#comment-14370841 ] Claus Ibsen commented on CAMEL-8520: ------------------------------------ Now using static code blocks and static configuration classes as how smack is done is of course a very bad idea - but that is how they decided to code their library - nothing we can do here. > Camel XMPP doesn't use a DNS resolver to look at SRV records > ------------------------------------------------------------ > > Key: CAMEL-8520 > URL: https://issues.apache.org/jira/browse/CAMEL-8520 > Project: Camel > Issue Type: Bug > Components: camel-xmpp > Affects Versions: 2.15.0 > Reporter: Ben Harris > > Camel XMPP doesn't use a DNS resolver to look at SRV records, whereas in 2.14.1 it did. > In 2.15.0, ConnectionConfiguration calls {{DNSUtil.resolveXMPPDomain(serviceName)}} which runs this code: > {code:title=DNSUtil.java|borderStyle=solid} > public static List resolveXMPPDomain(final String domain) { > if (dnsResolver == null) { > List addresses = new ArrayList(1); > addresses.add(new HostAddress(domain, 5222)); > return addresses; > } > return resolveDomain(domain, 'c'); > } > {code} > dnsResolver is never initialised, so it returns the service name, in my case 'jabberzac.org', instead of the actual XMPP server from the SRV Record, 'xmpp.jabberzac.org', which then causes a timeout. > The dnsResolver is meant to be instantiated in init(), which is meant to be called by SmackConfiguration, but never is. > {code:title=DNSUtil.java|borderStyle=solid} > /** > * Initializes DNSUtil. This method is automatically called by SmackConfiguration, you don't > * have to call it manually. > */ > public static void init() { > final String[] RESOLVERS = new String[] { "javax.JavaxResolver", "minidns.MiniDnsResolver", > "dnsjava.DNSJavaResolver" }; > for (String resolver :RESOLVERS) { > DNSResolver availableResolver = null; > String resolverFull = "org.jivesoftware.smack.util.dns" + resolver; > try { > Class resolverClass = Class.forName(resolverFull); > Method getInstanceMethod = resolverClass.getMethod("getInstance"); > availableResolver = (DNSResolver) getInstanceMethod.invoke(null); > if (availableResolver != null) { > setDNSResolver(availableResolver); > break; > } > } > catch (ClassNotFoundException|NoSuchMethodException|SecurityException|IllegalAccessException|IllegalArgumentException|InvocationTargetException e) { > LOGGER.log(Level.FINE, "Exception on init", e); > } > } > } > {code} > 2.14.1 doesn't seem to have this problem as DNSUtil class in 2.14.1 doesn't have an init() function which is meant to be 'automatically called', it just has a static code block: > {code} > static { > try { > Hashtable env = new Hashtable(); > env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory"); > context = new InitialDirContext(env); > } > catch (Exception e) { > // Ignore. > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)