服务器地址为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地址。
答案 0 :(得分:0)
在您使用的任何端口上没有运行169.254.111.240的RMI注册表,默认端口为1099.