是否有新的 Java 库支持 Solaris 上的 IPv6?

发布于 2024-08-01 21:14:52 字数 578 浏览 4 评论 0原文

我正在执行以下操作来查找 Internet 地址。 特别是在 resolv.conf 中具有 IPv6 名称服务器的 Solaris 计算机上,它会失败。 在具有 IPv6 名称服务器的 Windows 计算机和仅 IPv4 的 Solaris 计算机上运行良好。 从返回的错误来看,当与 IPv6 名称服务器一起出现时,Java“getAttributes”行在内部(某处较深)出现解析问题。 我的问题是,“当使用 IPv6 时,有没有一种方法可以更好地在 Solaris 上正常工作?”

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" }); 

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" }); 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不及他 2024-08-08 21:14:53

较新版本的 Java 工作得“更好”。 升级到 Java 7 后不再出现这样的内部失败。

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

意中人 2024-08-08 21:14:52

基本 java.net.InetAddress 具有有 IPv6 变体和 IPv4 自 Java 1.4 以来的变体(根据 javadoc)。

听起来您对 com.sun.jndi.dns.DnsContextFactory 有更多疑问。 Java 什么版本?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文