public class WarehouseServer {
public static void main(String[] args) throws RemoteException, NamingException {
System.out.println("Constructing server implementation...");
WarehouseImpl centralWarehouse = new WarehouseImpl();
System.out.println("Binding server implementation on registry...");
Context namingContext = new InitialContext();
LocateRegistry.createRegistry(1099);//必须打开端口
namingContext.bind("rmi:central_warehouse", centralWarehouse);
System.out.println("Waiting for invocations from clients....");
}
}