I have developed a simple RMI primary and backup server that need to be connected with the same registry but is giving always the same error when I try to put the primary down and the backup need to come "alive" Exception in thread "main" java.rmi.ConnectException: Connection refused to host: 192.168.1.74; nested exception is:

RMI primary code:
Java Code:
public class ServerRMI {
	public static void main(String args[]) throws SQLException, RemoteException {
		System.getProperties().put("java.security.policy", "policy.all");
		System.setSecurityManager(new RMISecurityManager());
		Registry registry = null;
		try {
			registry = LocateRegistry.createRegistry(12345);
			registry.rebind("ServerRMI", new Servidor_RMI());
        } catch (RemoteException re) 
        {
        	System.err.println("Exception in HelloImpl.main: " + re);
       
        	
        	}
        }

Backup RMI server:
Java Code:
public class RMI_BACKUPT {
	public static void main(String args[]) throws SQLException, RemoteException, MalformedURLException, NotBoundException {
		Registry registry = null;
		System.getProperties().put("java.security.policy", "policy.all");
		System.setSecurityManager(new RMISecurityManager());
		try {
			
			ExecuteCommands server2 = (ExecuteCommands) Naming.lookup("rmi://" + "localhost" + ":12345" + "/ServerRMI");
			while(true){
				server2.teste4();
				
			}
			
        } catch (RemoteException re) 
        {
        	
        	registry=LocateRegistry.getRegistry();
        
        	registry.rebind("ServerRMI", new Servidor_RMI());
        
        	
        	}
        }
where am I doing wrong?