简体   繁体   English

Java RMI 无法连接到注册表

[英]Java RMI can not connect to registry

I have an server process with internal registry (on an Amazon EC2 instance).我有一个带有内部注册表的服务器进程(在 Amazon EC2 实例上)。 The server starts correctly and the registry binds itself to port 1099. If I use netstat I can see that it is bound:服务器正确启动,注册表将自身绑定到端口 1099。如果我使用 netstat,我可以看到它已绑定:

tcp6     0      0    :::1099    :::*    LISTEN     0     3258   765/java

Additionally I've added Port 1099 TCP to the security group of the instance.此外,我已将端口 1099 TCP 添加到实例的安全组。 If I sstart nmap on the host, it lists the port as open:如果我在主机上启动 nmap,它会将端口列为打开:

Host is up (0.061s latency).
Not shown: 997 filtered ports
PORT     STATE  SERVICE
22/tcp   open   ssh
1098/tcp closed unknown
1099/tcp open   unknown

However, it is no possible for the client to connect to the server.但是,客户端无法连接到服务器。 After a while I get an java.net.ConnectException: Connection timed out exception.过了一会儿,我得到一个java.net.ConnectException: Connection timed out异常。

What am I missing?我错过了什么? Are there other ports that need to be opened?还有其他端口需要打开吗?

You need to make sure that your exported objects use the same port as the registry (or some other visible port).您需要确保导出的对象使用与注册表相同的端口(或其他一些可见端口)。 most likely you are connecting to the registry and then not able to connect to the port on which the object is exported.很可能您正在连接到注册表,然后无法连接到导出对象的端口。 finally--i'm not super familiar with ipv6--but you should verify that you are binding to the external network interface and not a loopback interface.最后——我对 ipv6 不是很熟悉——但是你应该验证你绑定到外部网络接口而不是环回接口。

Well, im pretty sure I had to open another port.好吧,我很确定我必须打开另一个端口。 Because when I opened all ports for incoming traffic, it worked.因为当我为传入流量打开所有端口时,它起作用了。

Since this was only a test setup i lived with that and simply restricted incoming traffic to well known sources.由于这只是一个测试设置,我接受了它并且只是将传入流量限制为众所周知的来源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM