在Netbeans下,我創建了一個包含接口「i_object」的項目這個接口代表遠程對象「impl_i_object」和「impl_i_object」實現所有的接口方法。 一個主要類到客戶端「Main_client」,一個用於服務器「Main_server」...當我啓動服務器和客戶端時,它的工作順利。RMI,ClassNotFoundException
但是,當我從我的項目分成兩個項目(客戶端和服務器),看截圖:
在這裏,當我運行服務器時,它的工作原理,但是當我運行客戶端它顯示此錯誤:
Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: server.i_object (no security manager: RMI class loader disabled)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:101)
at client.Main_client.main(Main_client.java:24)
Caused by: java.lang.ClassNotFoundException: server.i_object (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:554)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:646)
at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:311)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:257)
at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1549)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1511)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
... 3 more
Java Result: 1
有什麼問題?
您嘗試使用client.i_object而不是server.i_object。另外,請閱讀Java編碼轉換(http://www.oracle.com/technetwork/java/codeconv-138413.html)。 – weekens