我试图通过RMI连接到服务器,但是无法正常工作

时间:2018-02-02 16:18:14

标签: java rmi

服务器地址为192.168.0.104。当我尝试连接客户端程序时,会给出以下异常:

C:\Users\Atreya\Desktop>java -jar Clientjar.jar
Enter IP address of server
192.168.0.104
Client exception: java.rmi.ConnectException: Connection refused to host: 169.254
.111.240; nested exception is:
        java.net.ConnectException: Connection refused: connect
java.rmi.ConnectException: Connection refused to host: 169.254.111.240; nested e
xception is:
        java.net.ConnectException: Connection refused: connect
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
        at sun.rmi.server.UnicastRef.newCall(Unknown Source)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
        at RMIClient.main(RMIClient.java:18)

现在169.254.111.240是客户端计算机以太网适配器的自动配置ipv4地址。

1 个答案:

答案 0 :(得分:0)

在您使用的任何端口上没有运行169.254.111.240的RMI注册表,默认端口为1099.