我嘗試使用命令提示符在Windows8系統上安裝開源軟件。 我從來沒有做過類似的事情,我也不是很有經驗的使用RMI。我需要一些幫助來解決我遇到的異常錯誤。 這是我遵循的程序:我已經設置了CLASSPATH這樣java.rmi.ConnectException:連接拒絕主機192.168.56.1
set CLASSPATH=C:\kuwaiba7\service\lib\PersistenceAbstractionAPI.jar;C:\kuwaiba7\service\lib\PersistenceServiceRemoteInterfaces.jar
然後我開始RMI註冊表:
start "C:\Program Files\Java\jdk1.7.0_71\bin\rmiregistry.exe
一個新的命令提示符窗口打開。在此窗口中我的PersistenceService運行以下命令:
C:\kuwaiba7\service>java -Djava.rmi.server.codebase="file:/C:/kuwaiba7/service/l
ib/PersistenceAbstractionAPI.jar file:/C:/kuwaiba7/service/lib/PersistenceServiceRemoteInterfaces.jar" -jar PersistenceService.jar
第一行顯示到數據庫的連接建立,但後來我得到一個:java.rmi.ConnectException錯誤。
[Sun Nov 23 13:57:02 EET 2014] Current working directory: C:\kuwaiba7\service
[Sun Nov 23 13:57:02 EET 2014] Establishing connection to the database...
[Sun Nov 23 13:57:03 EET 2014] Connection established
EmbeddedGraphDatabase [C:\kuwaiba7\service\target\kuwaiba.db]
[Sun Nov 23 13:57:04 EET 2014] Registry obtained
java.rmi.ConnectException: Connection refused to host: 192.168.56.1; 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.rebind(Unknown Source)
at org.kuwaiba.persistenceservice.Main.main(Main.java:72)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(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)
... 6 more
[Sun Nov 23 13:57:05 EET 2014] Abnormal program termination. See log file for details
我的問題是: 1)我怎麼能肯定的是,RMI運行是否正常? 2)我得到這個異常是否意味着我的RMI不運行? 3)如何在命令提示符下解決這個異常錯誤?
我也想提一提,設置類路徑之前我得到另一個錯誤: java.rmi.serverException java.rmi.unmarshalException 拋出java.lang.ClassNotFoundException
後設置classpath中,我停止了越來越這些錯誤。
我會在這裏申請任何幫助。正如我所提到的,我在RMI方面工作經驗不是很豐富,所以請耐心等待! :)
感謝 季米特里斯
您似乎已經啓動,然後停止註冊表。當您發出START命令時,會打開一個新的命令窗口,但這是針對註冊表的。你不能在其中運行任何你自己的東西。 – EJP 2014-11-23 21:59:33
是的。你是對的。我愚蠢的使用我運行regitstry的窗口。如果你想回答問題來接受它。 – user1919 2014-11-25 12:32:15