vks
vks

Reputation: 7071

Simple RMI Application

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.

Upvotes: 0

Views: 2774

Answers (3)

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.

Upvotes: 1

user207421
user207421

Reputation: 310840

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.

Upvotes: 0

Brandon E Taylor
Brandon E Taylor

Reputation: 25339

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.

Upvotes: 1

Related Questions