camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Harris (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-8520) Camel XMPP doesn't use a DNS resolver to look at SRV records
Date Fri, 20 Mar 2015 06:36:38 GMT

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

Ben Harris commented on CAMEL-8520:
-----------------------------------

If they are in {{org.jivesoftware.smack.util.dns}} shouldn't they be part of camel-xmpp's
smack dependencies?

see: https://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/smack/util/dns/dnsjava/DNSJavaResolver.html

> 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)

Mime
View raw message