經過艱苦的努力,我已經建立了使用Apache的Java RMI隧道作爲http服務器的http 。一切都很好,在我的辦公室LAN工作起來就像一個魅力。但是當我安裝在客戶端時,我收到了一些異常.RMI系統只能在他的服務器上工作。java.rmi.ConnectException:連接拒絕主機
當我嘗試從其他客戶的PC,我得到以下。
你們能幫我解決嗎?
java.rmi.ConnectException: Connection refused to host: 172.xx.x.xxx;
nested exception is: java.net.ConnectException: Connection timed
out: 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.invoke(Unknown Source) at
java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown
Source) at
java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source)
at $Proxy1.getUserID(Unknown Source) at
rmi.source.ServerImpl$JobScheduler.run(ServerImpl.java:265) at
java.util.TimerThread.mainLoop(Unknown Source) at
java.util.TimerThread.run(Unknown Source) Caused by:
java.net.ConnectException: Connection timed out: 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) ... 10 more
我用LocateRegistry.getRegistry(rmiHost,rmiPort,新sun.rmi.transport.proxy.RMIHttpToCGISocketFactory())通過將相同的端口 我在服務器中創建一個遠程對象獲取註冊表使用由所有小程序客戶端。 此外,我還在jre和catalina.policy文件中爲java.policy文件提供了完全權限。有趣的是,中間沒有防火牆m/c將請求路由到服務器。 但在每個m/c上啓用了windows防火牆。這與我的辦公室中RMI系統正常工作的情況相同。 – SachinIndia 2011-04-07 11:19:58
你如何創建服務器端的遠程對象?它們是否繼承UnicastRemoteObject,如果是,那麼你使用的是哪個super.ctor? – 2011-04-07 17:52:11
謝謝你的回覆我在leave.My服務器類繼承UnicastRemoteObject。我使用的構造函數只是super() – SachinIndia 2011-04-12 06:59:02