Java - RMI - Caused by: java.lang.IllegalArgumentException: illegal remote method encountered

Problem:

Caused by: java.lang.IllegalArgumentException: illegal remote method encountered: public abstract java.util.List suncertify.server.Server.getAccomodation()

Used Interface:


public interface Server extends java.rmi.Remote, Serializable {
List getAccomodation();
List getAccomodation(String criteria);
List getAccomodation(int recNo);
List bookAccomodation(int recNo);
}


Solution:


Java RMI and Remote interface make mandatory for all methods to throw RemoteException


public interface Server extends java.rmi.Remote, Serializable {
List getAccomodation() throws RemoteException;
List getAccomodation(String criteria) throws RemoteException;
List getAccomodation(int recNo) throws RemoteException;
List bookAccomodation(int recNo) throws RemoteException;
}

and 

(...)
/** 
 * @return The Server
 * @throws RemoteException 
 */
public List getData() throws RemoteException{    
    return server.getAccomodation();
}

Comments

Popular posts from this blog

Oracle - duplicate fields in RECORD,TABLE or argument list are not permitted

Oracle - ORA-29282: invalid file ID, ORA-06512: at "SYS.UTL_FILE"