问题描述
大侠们,我遇到一个rmi客户端异常问题,帮忙看一下:ComputeEngine_Stub[UnicastRef[liveRef:[endpoint:[127.0.0.1:1987](remote),objID:[f7f6b2a:120f0ddc142:-8000,0]]]]java.rmi.ConnectException:Connectionrefusedtohost:127.0.0.1;nestedexceptionis:java.net.ConnectException:Connectionrefused:connectatsun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)atsun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)atsun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)atsun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)atcom.ls.rmiservice.sample.ComputeEngine_Stub.executeTask(UnknownSource)atcom.ls.client.sample.ComputePi.main(ComputePi.java:28)Causedby:java.net.ConnectException:Connectionrefused:connectatjava.net.PlainSocketImpl.socketConnect(NativeMethod)atjava.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)atjava.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)atjava.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)atjava.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)atjava.net.Socket.connect(Socket.java:519)atjava.net.Socket.connect(Socket.java:469)atjava.net.Socket.<init>(Socket.java:366)atjava.net.Socket.<init>(Socket.java:179)atsun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)atsun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)atsun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)...5more服务器端已经启动了,并且绑定了服务。客户端程序请求服务时,registry.lookup("....");执行没有问题,并且拿回了对象,打印如:ComputeEngine_Stub[UnicastRef[liveRef:[endpoint:[127.0.0.1:1987](remote),objID:[f7f6b2a:120f0ddc142:-8000,0]]]]之后,调用返回对象的方法,就抛了上述异常。请问怎么解决呀?谢谢。
解决方案
解决方案二:
Done!