当前位置: 代码迷 >> Java相关 >> java rmi服务器端报以下异常,跪求解决
  详细解决方案

java rmi服务器端报以下异常,跪求解决

热度:8266   发布时间:2013-02-25 21:48:15.0
java rmi服务器端报以下错误,跪求解决
Exception in thread "main" java.rmi.ConnectException: Connection refused to host: 192.168.3.248; nested exception 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.bind(Unknown Source)
at java.rmi.Naming.bind(Unknown Source)
at com.rmi.RmiServer.main(RmiServer.java:13)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
... 7 more

------解决方案--------------------------------------------------------
个人认为:估计无启动一个registry。可以让代码自动启动一个LocateRegistry.createRegistry(1099)。或者用jdk下rmiregisty直接启动,不过要先设置classpath包括要绑定的java类.
  相关解决方案