Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RemoteException java.rmi.UnmarshalException: error unmarshalling return [duplicate]

I'm running the program here on 2 JVMs on diff physical machines. I get the error

RemoteException
java.rmi.UnmarshalException: error unmarshalling return; nested exception is: 
    java.lang.ClassNotFoundException: CalculatorImpl_Stub (no security manager: RMI class loader disabled)

I've even tried running it on the same machine(unchanged program) and it works but it doesnt work on diff machines. Can someone pls help me out?

@beny23- Thanks but I still end up with this error:

RemoteException
java.rmi.UnmarshalException: error unmarshalling return; nested exception is: 
java.lang.ClassNotFoundException: CalculatorImpl_Stub

How can the client side have a copy of CalculatorImpl_stub?

like image 465
P R Avatar asked Sep 08 '11 22:09

P R


4 Answers

I had this problem because I had different package names in client and server code:

package my.pkg; 
// server side interface definition...

// ------------- //

package my.pkg.something;
// client side interface definition...

I changed the name of client-side package and set it as the name of server-side package:

package my.pkg; 
// server side interface definition...

// ------------- //

package my.pkg; // renamed to the name of package in server-side .
// client side interface definition...

and the problem went away.

like image 89
Amin Saqi Avatar answered Nov 10 '22 13:11

Amin Saqi


i solved it with rename package name. the server and client is in two different project , but rather with same package naming.

like image 41
DanialAbdi Avatar answered Sep 22 '22 12:09

DanialAbdi


I had a working RMI Client and Server for my Java class. I decided to place these into their own packages rather than running as a default package.

After I placed them in their own Packages the java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.lang.ClassNotFoundException: error started happening on connection,.

I put the programs back into the default package and it all started working again.

I realize that there is probably a technical reason for this, but this worked for me!

like image 9
Rahim Khoja Avatar answered Nov 10 '22 11:11

Rahim Khoja


It sounds like your not using a security manager:

Have you got a policy file (my.policy):

grant {
  permission java.security.AllPermission;
};

and run your program using

java -Djava.security.manager -Djava.security.policy=/some/path/my.policy MyClass
like image 7
beny23 Avatar answered Nov 10 '22 12:11

beny23