简单的 RMI 应用程序
我创建了一个简单的 RMI 应用程序,它只是向 RMI 服务器发送一条消息。但是在发送消息时我收到了错误消息。我正在使用 eclipse 来运行程序。
sending hello to 10.0.0.12:3233
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: com.zoondia.ReceiveMessageInterface (no security manager: RMI class loader disabled)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at test.rmi.RmiClient.main(RmiClient.java:28)
Caused by: java.lang.ClassNotFoundException: com.zoondia.ReceiveMessageInterface (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
任何人都知道问题是什么。我正在使用 eclipse 来运行该程序。我是否需要在 eclipse 中使用 rmi 编译器,或者在运行程序时它会自动编译。
谢谢, VKS。
I have created a simple RMI application, that just send a message to RMI server.But when sending a message i got the error message.I am using eclipse for running the programs.
sending hello to 10.0.0.12:3233
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: com.zoondia.ReceiveMessageInterface (no security manager: RMI class loader disabled)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at test.rmi.RmiClient.main(RmiClient.java:28)
Caused by: java.lang.ClassNotFoundException: com.zoondia.ReceiveMessageInterface (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
Anybody knows what is the issue.Am using eclipse for running the program.is i needed rmi compailor in eclipse, or it compails automatically when running the program.
Thanks,
VKS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
该异常表示在您的服务器中安装 RMI 安全管理器失败。除非设置了安全管理器,否则 RMI 将无法从您的客户端下载任何代码。
您需要在服务器代码中执行类似以下操作:
查看 RMISecurityManager 了解更多信息。
The exception is indicating a failure to install an RMI security manager in your server. Unless a security manager is set, RMI will be unable to download any code from your client.
You need to do something like the following in your server code:
Check out the javadocs for RMISecurityManager for more information.
对于第一个错误,即解组参数,我曾经遇到过该错误。确保在运行 rmiregistry 之前将目录更改为 src 文件夹
对于第二个错误,请确保已为服务器和客户端创建策略文件。
For the first error, i.e unmarshalling arguments, i had that error once. Ensure you change the directory to your src folder before running the rmiregistry
For the second error, ensure you have created your policy files for both the server and the client.
异常表明指定的类不存在于客户端的类路径中。
这可能是由于以下两个原因之一造成的:
您没有使用代码库功能,也没有在客户端 JAR 文件中包含该类。
您正在使用代码库功能,但尚未安装安全管理器。
The exception is indicating that the class named is not present in the client's classpath.
That can be due to one of two causes:
You aren't using the codebase feature and you haven't included the class in the client JAR files.
You are using the codebase feature and you haven't installed a security manager.