简体   繁体   中英

RMI, ClassNotFoundException

under Netbeans ,I created a project containing an interface "i_object" This interface represents the remote object "impl_i_object" and "impl_i_object" implements all the interface method. one main class to the client "Main_client" and one for the server "Main_server" ... when I start the server and the client its work smoothly.

在此处输入图片说明

But when I separated from my project into two projects (client and server) look at the screenshot:

在此处输入图片说明

here, when I run the server it works but when I run the client it display this error :

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

what's the problem ?

对我有用的是在每个项目服务器和客户端中用相同的软件包名称在软件包中复制接口

it says :

no security manager: RMI class loader disabled

RMI requires a security manager to run.

Example:

http://www.coderanch.com/t/459111/java/java/no-security-manager-rmi-class

UPDATE: This link talks about the security in RMI

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM