RemoteException java.rmi.UnmarshalException: error unmarshalling return

P R picture P R · Sep 9, 2011 · Viewed 43.3k times · Source

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?

Answer

Amin Saqi picture Amin Saqi · Jun 20, 2014

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.