在不同网络上时出现 JBoss UnknownHostException

发布于 2024-07-19 08:45:49 字数 1346 浏览 2 评论 0原文

我在让 JBoss 跨网络工作时遇到了一些问题。 快速概述一下,我们有一个开发网络(我将其称为 DEV)和一个客户端网络(比如.. CLIENT!)。 它们通过防火墙连接。 在开发网络中,服务器称为 192.168.100.50,在客户端网络上称为 10.0.100.50。 两个网络中的DNS均通过DNS(sqlserver.dev.net)解析相关IP。

sqlserver 提供 2 种服务,一种通过 .NET Web 服务,另一种通过 JBoss。 当在 DEV 网络上运行客户端时,这两个服务都工作正常。 在 CLIENT 网络上时,只有 .NET 服务可以工作。

当尝试执行以下代码中的 ContextLookup 时,JBoss 客户端抛出 UnknownHostException:

Properties p = new Properties();
p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.factory.url.pkgs", "=org.jboss.naming:org.jboss.jnp.interfaces");
p.put("java.naming.provider.url", "sqlserver.dev.net:1199");

try {
  Context c = new InitialContext(p);
  cm = (ServiceRemote)c.lookup(Service.RemoteJNDIName);
} catch (NamingException e) {
  e.printStackTrace();
  throw new RuntimeException(e);
}

异常是:

根异常是java.rmi.UnknownHostException:未知主机:SQLserver

我可以确认问题是客户端正在尝试连接到没有域名的“sqlserver”。 这已经通过将“sqlserver”添加到客户端的主机文件进行了测试,并且工作正常。 另外,“SQLserver”的拼写很有趣,因为这是 Windows 主机报告其主机名的方式,而不是它在 DNS 中的存储方式。 我最好的猜测是,一旦客户端建立初始连接,JBoss 就会告诉客户端将来连接到“SQLserver”,而客户端无法解析该连接。

我已经尝试将以下系统属性设置为 sqlserver 的 FQDN:

jgroups.bind_addr
绑定地址
java.rmi.server.主机名

有人有什么想法吗?

I'm having a bit of a problem with getting JBoss working across networks. As a quick overview, we have a development network (which I'll call DEV), and a client network (say.. CLIENT!). These are connected via a firewall. In the Dev network, the server is known as 192.168.100.50, on the client network it's known as 10.0.100.50. DNS in both networks resolve the relevant IP by DNS (sqlserver.dev.net).

sqlserver provides 2 services, one via a .NET Web Service, the other by JBoss. When running the client on the DEV network, both services work fine. When on the CLIENT network, only the .NET service works.

The JBoss client throws an UnknownHostException when attempting to perform the ContextLookup in the following code:

Properties p = new Properties();
p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.factory.url.pkgs", "=org.jboss.naming:org.jboss.jnp.interfaces");
p.put("java.naming.provider.url", "sqlserver.dev.net:1199");

try {
  Context c = new InitialContext(p);
  cm = (ServiceRemote)c.lookup(Service.RemoteJNDIName);
} catch (NamingException e) {
  e.printStackTrace();
  throw new RuntimeException(e);
}

Exception is:

Root exception is java.rmi.UnknownHostException: Unknown host: SQLserver

I can confirm that the problem is that the client is attempting to connect to 'sqlserver' without a domain name. This has been tested by adding 'sqlserver' to the client's host file, and it works fine. Additionall, the spelling of 'SQLserver' is interesting, as this is how the Windows host reports it's hostname, not how it's stored in DNS. My best guess is that once the client makes the initial connection, JBoss tells the client to connect to 'SQLserver' in the future, which the client is unable to resolve.

I've already tried setting the following system properties to the FQDN of sqlserver:

jgroups.bind_addr
bind.address
java.rmi.server.hostname

Does anyone have any ideas?

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

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

发布评论

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

评论(2

泪意 2024-07-26 08:45:49

好吧,事实证明,在启动时绑定到 0.0.0.0 实际上会扰乱它的自我识别。 绑定到 sqlserver.dev.net (run.bat -b sqlserver.dev.net) 修复了它。

Ok, turns out that binding to 0.0.0.0 on startup actually messes up it's self-identification. Binding to sqlserver.dev.net (run.bat -b sqlserver.dev.net) fixed it.

空名 2024-07-26 08:45:49

可能您的网络有代理服务器,您需要在属性检查中提供代理服务器 IP 和代理端口。

May be your network having proxy server, you need to provide that proxy server ip and port of proxy in properties check for those.

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