从主机到虚拟服务器的连接失败,无法从 Java 访问网络

发布于 2024-08-24 15:55:04 字数 446 浏览 4 评论 0原文

我有一台服务器,上面运行着多个虚拟机。我尝试使用 Java 连接到其中一台服务器,但失败并显示“网络无法访问”。用例是 Hudson 连接以在 Windows 机器上运行从属设备。它使用 python 套接字工作,所以很奇怪。

这是主机 http://dpaste.com/168704/ 上的网络配置。 使用此代码段 http://dpaste.com/168708/ 重现该问题。

有什么想法吗?我只能用java重现这个问题。 ssh、ping、python 和 nc 也经过测试并且可以工作。

编辑: 似乎来自 java 的所有出站连接都遭受与主机相同的命运。

I have a server that has several virtual machines running on it. I'm trying to connect to one of these servers using Java, but it fails with "Network unreachable". The usecase is Hudson connecting to run a slave on a windows-machine. It works using python sockets, so it's quite odd.

This is the network configuration on the host machine http://dpaste.com/168704/ .
The problem is reproduced using this snippet http://dpaste.com/168708/ .

Any ideas? I've only managed to reproduce this problem with java. ssh, ping, python and nc was tested as well and they work.

Edit:
Seems that all outbound connections from java suffers the same fate from the host machine.

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

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

发布评论

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

评论(2

像极了他 2024-08-31 15:55:04

我遇到了这个错误 http://bugs.debian.org/ cgi-bin/bugreport.cgi?bug=560056

所以现在可以使用快速修复方法:-)

I was hit by this bug http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560056 .

So works now with the quick fix :-)

梦开始←不甜 2024-08-31 15:55:04

很可能正在解析错误的主机名地址。将此调试添加到您的测试中:

InetSocketAddress saddr = 
  new InetSocketAddress("waltraction.dhcp.samfundet.no", 135);
InetAddress addr = saddr.getAddress();
if (addr == null) {
  System.out.println("Unresolved address.");
else 
  System.out.println(addr.getHostAddress());

仅查看正在使用的地址可能会指出问题,但如果没有,请更新问题并获得更多帮助。

It's likely that the wrong address is being resolved for the host name. Add this debugging to your test:

InetSocketAddress saddr = 
  new InetSocketAddress("waltraction.dhcp.samfundet.no", 135);
InetAddress addr = saddr.getAddress();
if (addr == null) {
  System.out.println("Unresolved address.");
else 
  System.out.println(addr.getHostAddress());

Simply seeing the address being used may point out a problem, but if not, update the question and get more help.

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