Search code examples
javarmi

java.rmi.UnmarshalException: unrecognized method hash: method not supported by remote object


I have two web application, the first one RMIServer contains the following

public interface EasyPDFGeneratorRemoteInterface extends Remote {

public File generatePDFAmin(File sourceFile) throws RemoteException ;
}

public class EasyPDFGenerator extends UnicastRemoteObject 
    implements EasyPDFGeneratorRemoteInterface {


    public File generatePDFAmin(File sourceFile)  {
//implementation details....
}

then an object of type EasyPDFGenerator is registered in the registry.

And the Second contains

public interface EasyPDFGeneratorRemoteInterface extends Remote {

public File generatePDFAmin(File sourceFile) throws RemoteException ;
}

class test {

private File generatePDF(File file) {

    File pdfFile = null;
    try {

        EasyPDFGeneratorRemoteInterface easyPDFGenerator = getRemoteEasyPDFGenerator();// get the remote object.
        easyPDFGenerator.getClass.getMethods();// the array contains the method generatePDFAmin.
        pdfFile = easyPDFGenerator.generatePDFAmin(file);// throws the exception.

    } catch (RemoteException ex) {

    }

}
}

I am not sure what could be causing the problem since am getting the remote object ,and it does contain the method that the UnmarshalException is thrown when it gets invoked.


Solution

  • You changed your remote interface definition without reploying all the .class files affected. If you're using a generated stub, you didn't regenerate that either.