Search code examples
javaserializationrmi

Java RMI Unmarshall Exception


I'm calling this remote method:

RespuestaError<Co>  cox(String a, String b, String c, int d) throws RemoteException;

I'm getting this error

java.rmi.UnmarshalException: error unmarshalling return; nested exception is: 
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: jtwitter.base.RespuestaError

It's saying that RespuestaError is not Serializable but it is:

public class RespuestaError<T extends Serializable> implements Serializable {

    private static final long serialVersionUID = 8483079015565009698L;

    private T returned;
    private Error error;

    public RespuestaError(T returned, Error error)
    {
      //...
    }

     //...
}

Where Error is a enum. In this particular case T is:

public class Co implements Serializable {

    private static final long serialVersionUID = 2759254657635643074L;

    private String  a;
    private int     b;
    private Us  c;

    public Co(String a, int b, Us c)
    {
        //...
    }

    //...
}

And the Us class is:

public class Us implements Serializable {

    private static final long serialVersionUID = -6725570673833522155L;

    private int a;
    private String b; 
    private String c;
    private String d;
    private String e;
    private int    f;

    public Us(int a, String b, String c, String d, String e, int f)
    {
        //...
    }

    //...
}

Everithing extends Serializable I don't see the error.


Solution

  • There is no error in the code. The problem is that I'm not running the code that i'm thinking im running. Cleaning and Re-compiling all files solves this problem.