Posts

Showing posts from September, 2013

java rmi server ExportException internal error ObjID already use

Problem:

Sep 21, 2013 9:12:09 AM suncertify.main.URLyBirdMain main INFO: Executing in server mode. Sep 21, 2013 9:12:09 AM suncertify.server.RMIFactoryServerImpl INFO: rmi://127.0.0.1:1099/URLyBirdRMIServer java.rmi.server.ExportException: internal error: ObjID already in use at sun.rmi.transport.ObjectTable.putTarget(ObjectTable.java:169) at sun.rmi.transport.Transport.exportObject(Transport.java:74) at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:229) at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:393) at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:129) at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:188) at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:100) at sun.rmi.registry.RegistryImpl.(RegistryImpl.java:86) at java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:186) at suncertify.server.RMIFactoryServerImpl.(RMIFactoryServerImpl.java:38) at suncertify.server.RMIFactoryServerImpl.(RMIFactoryServ…

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:


publicinterface 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


publicinterface 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{
returnserver.getAccomodation();
}