You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2015/03/20 07:36:39 UTC

[jira] [Comment Edited] (CAMEL-8520) Camel XMPP doesn't use a DNS resolver to look at SRV records

    [ https://issues.apache.org/jira/browse/CAMEL-8520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14370847#comment-14370847 ] 

Claus Ibsen edited comment on CAMEL-8520 at 3/20/15 6:36 AM:
-------------------------------------------------------------

And they have a bug in the code loading the resolvers

This is the resolved name in the java code:
{code}
org.jivesoftware.smack.util.dnsdnsjava.DNSJavaResolver
{code}

Notice the a dot is missing
{code}
org.jivesoftware.smack.util.dns.dnsjava.DNSJavaResolver
{code}


was (Author: davsclaus):
And they have a bug in the code loading the resolvers

This is the resolved name in the java code:
{code}
org.jivesoftware.smack.util.dnsdnsjava.DNSJavaResolver
{code}

Notice the a dot is missing
{code}
org.jivesoftware.smack.util.dns.dnsjava.DNSJavaResolver
{cpde}

> 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<HostAddress> resolveXMPPDomain(final String domain) {
>         if (dnsResolver == null) {
>             List<HostAddress> addresses = new ArrayList<HostAddress>(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)