Question

I'm doing the following to lookup an Internet address. It fails specifically on Solaris machines that have IPv6 nameservers in the resolv.conf. Works fine on Windows machines that have IPv6 nameservers and on IPv4 only Solaris machines. From the error returned it appears that the Java "getAttributes" line is failing internally (somewhere deep) with a parsing problem when presented with an IPv6 nameserver. My question is, "is there a way to do this better that works properly on Solaris when IPv6 is in use?"

InetAddress localhost=InetAddress.getLocalHost();
ipAddress=localhost.getHostAddress();
env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
DirContext ictx = new InitialDirContext(env);
Attributes attrs=ictx.getAttributes("blah.test.fakedomain", new String[] { "A" }); 
Was it helpful?

Solution 2

Newer versions of Java work "better". No longer fails internally like this after upgrading to Java 7.

OTHER TIPS

The base java.net.InetAddress has had IPv6 variants and IPv4 variants since Java 1.4 (per the javadoc).

Sounds like you've got more of a question about com.sun.jndi.dns.DnsContextFactory. What version of Java?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top