开发者

Simple RMI Application

开发者 https://www.devze.com 2023-04-08 05:44 出处:网络
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.

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.


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号