Rmi客户端无法找到服务器存根

时间:2016-06-16 14:08:31

标签: java rmi

我有一个服务器项目和一个客户端。服务器运行良好。服务器项目内的客户端运行正常。但是,当我创建另一个客户端项目,内部接口而不是服务器ofc时,我编译它,当我尝试运行它时,我得到这个错误。我已经阅读了很多东西,但没有任何工作,我尝试安全经理到客户端,我尝试了很多思考实际上,我一直得到这个错误,我还读到我需要启动一个新的rmi注册表为我试过的客户项目但是我不能开一个新的 错误:

运行:

Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling return; nested exception is: 
    java.lang.ClassNotFoundException: RMIServer03_Stub (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.<init>(Client.java:65)
    at Client.main(Client.java:141)
Caused by: java.lang.ClassNotFoundException: RMIServer03_Stub (no security manager: RMI class loader disabled)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:396)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:186)
    at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:637)
    at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:264)
    at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:219)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
    ... 4 more
C:\Users\blue-icon\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 1 second)

1 个答案:

答案 0 :(得分:0)

您只需要生成带有rmic的存根clas并将其部署到客户端。

每个有价值的RMI教程都会提到这一点。相当令人惊讶的是你没有遇到它。