简体   繁体   中英

Java RMI can not connect to registry

I have an server process with internal registry (on an Amazon EC2 instance). The server starts correctly and the registry binds itself to port 1099. If I use netstat I can see that it is bound:

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

Additionally I've added Port 1099 TCP to the security group of the instance. If I sstart nmap on the host, it lists the port as open:

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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