ta acontecendo esse erro quando eu tenho me conectar do cliente ao servidor:
Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect
Pelo que me parece o erro eh pq eu to rodando + de 1 servidor ... ae da refuse na hora do cliente conectar... Como faco pra fechar os servidores?? Aki msm reiniciando o pc da o erro.
package Servidor;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry ;
import java.rmi.RemoteException;
import java.rmi.AlreadyBoundException;
import java.rmi.server.UnicastRemoteObject;
import java.io.IOException;
import Beans.*;
public class ServidorImpl implements Servidor{
private Cadastro cadastro;
public ServidorImpl(){
cadastro = new Cadastro();
inicia();
}
public Cadastro getCadastro(){
return cadastro;
}
public void inicia(){
try{
Servidor stub = (Servidor) UnicastRemoteObject.exportObject (this, 0);
Registry registry = LocateRegistry.createRegistry(6000);
registry.bind ("War20", stub);
System.out.println ("Servidor iniciado");
}catch(RemoteException Re){
System.out.println(Re.getMessage());
}catch(AlreadyBoundException ABe){
System.out.println(ABe.getMessage());
}catch(IOException IOe){
System.out.println(IOe.getMessage());
}
}
public static void main(String args[]){
new ServidorImpl ();
}
}