简单的 RMI 应用程序

发布于 2024-12-06 11:40:08 字数 1307 浏览 0 评论 0原文

我创建了一个简单的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蝶舞 2024-12-13 11:40:08

该异常表示在您的服务器中安装 RMI 安全管理器失败。除非设置了安全管理器,否则 RMI 将无法从您的客户端下载任何代码。

您需要在服务器代码中执行类似以下操作:

if (System.getSecurityManager() == null) 
{
    System.setSecurityManager(new java.rmi.RMISecurityManager());
}

查看 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:

if (System.getSecurityManager() == null) 
{
    System.setSecurityManager(new java.rmi.RMISecurityManager());
}

Check out the javadocs for RMISecurityManager for more information.

狼亦尘 2024-12-13 11:40:08

对于第一个错误,即解组参数,我曾经遇到过该错误。确保在运行 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.

你是暖光i 2024-12-13 11:40:08

异常表明指定的类不存在于客户端的类路径中。

这可能是由于以下两个原因之一造成的:

  1. 您没有使用代码库功能,也没有在客户端 JAR 文件中包含该类。

  2. 您正在使用代码库功能,但尚未安装安全管理器。

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:

  1. You aren't using the codebase feature and you haven't included the class in the client JAR files.

  2. You are using the codebase feature and you haven't installed a security manager.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文