FreeBSD Java, IPv6, and DNS SRV query type

Benno Overeinder bjo at cs.vu.nl
Mon Aug 25 11:49:42 UTC 2008


Hi,

Sometimes you just want it all: Java, IPv6, *and* DNS SRV query type
requests.  Well, why?  We run an Openfire Jabber/XMPP server and want to
run this service with IPv6 support.

So what is the situation.  With the Diablo Caffe/Latte package, IPv6
support is not enabled.  (I don't know why, maybe someone can shed a
light on this?)

To get Java with IPv6 support, we installed jdk15 (and later jdk16)
using ports (java/jdk15 and java/jdk16).  During installation process we
enabled IPv6 in the configuration.

All set and go, and IPv6 worked with our Java programs, including the
Openfire server.

However, DNS SRV _xmpp-server._tcp.domain.name resolution fails with the
ports java/jdk16 build.  (Consequently, only Jabber servers that are
running on hosts known by their DNS domain name are found.)  For
example, contacts with a Google Talk account are not found.

I have written a small test program
(http://www.nlnetlabs.nl/~benno/opendir/DNSSRV.java) to check what is
going wrong.  Running DNSSRV with diablo jdk16 (no IPv6) or on a Linux
box with jdk16 (*with* IPv6), gives the following output:

Hostname: google.com, resolved hostname: xmpp-server4.l.google.com

(the result of a DNS SRV request type to google.com)

Running DNSSRV with Sun jdk16 from ports java/jdk16 results in the
following exception:

DNS error
javax.naming.CommunicationException: DNS error [Root exception is
java.io.IOException: Invalid argument]; remaining name
'_xmpp-server._tcp.google.com'
        at com.sun.jndi.dns.DnsClient.query(DnsClient.java:283)
        at com.sun.jndi.dns.Resolver.query(Resolver.java:64)
        at com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:413)
        at
com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:213)
        at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:121)
        at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:109)
        at
javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:123)
        at DNSSRV.resolveXMPPServerDomain(DNSSRV.java:80)
        at DNSSRV.main(DNSSRV.java:122)
Caused by: java.io.IOException: Invalid argument
        at java.net.PlainDatagramSocketImpl.send(Native Method)
        at java.net.DatagramSocket.send(DatagramSocket.java:612)
        at com.sun.jndi.dns.DnsClient.doUdpQuery(DnsClient.java:379)
        at com.sun.jndi.dns.DnsClient.query(DnsClient.java:186)
        ... 8 more
Catch 11
DNS error
Hostname: google.com, resolved hostname: google.com

>From what I can deduce, is that although the
_xmpp-server._tcp.google.com is a valid name for a DNS SRV request type,
the method DnsClient.query receives an invalid argument error (from a
native library, or other Java method not shown in the call stack
trace?).  Is the DNS SRV query type lost somewhere in interaction chain
with the native DNS resolver library?

Is this a problem with compiling jdk16 against our own libraries
(FreeBSD 6.3 and FreeBSD  and what is going wrong here?  Why does DNS
SRV works with Diablo jdk16, but not with our own compile ports
java/jdk16?

Or how do we get IPv6 working with Diablo jdk16?

Thanks,

-- Benno


-- 
Benno J. Overeinder
NLnet Labs
http://www.nlnetlabs.nl/




More information about the freebsd-java mailing list