View difference between Paste ID: uH3pqBqv and xFeiw3BG
SHOW: | | - or go back to the newest paste.
1-
/* Fui obrigado a criar essa interface que é exatamente igual a que está no outro computador servidor porque se não o NetBeans não me deixa compilar afirmando que não reconhece a classe Mensageiro.*/
1+
/*Same interface i have in my server computer.*/
2
package remoto;
3
import java.rmi.Remote;
4
import java.rmi.RemoteException;
5
6
public interface Mensageiro extends Remote {
7
    void enviarMensagem(String msg) throws RemoteException;
8
    String lerMensagem() throws RemoteException;
9
}
10
/**********************************************************************************************/
11
import remoto.*;
12
import java.rmi.registry.LocateRegistry;
13
import java.rmi.registry.Registry;
14
import java.rmi.RemoteException;
15
import java.rmi.NotBoundException;
16
public class MensageiroCliente {
17
18
    public static void main(String[] args) {
19
        try {
20
            Registry registry = LocateRegistry.getRegistry("192.168.1.102");
21-
             System.out.println("Deu merda logo aqui em cima! -> 1");
21+
22
            String resposta = m.lerMensagem();
23-
            System.out.println("Deu merda logo aqui em cima! -> 2");
23+
24
        }  catch (RemoteException e) {
25
            System.out.println();
26
            System.out.println("RemoteException: " + e.toString());
27
        } catch (NotBoundException e) {
28
            System.out.println();
29
            System.out.println("NotBoundException: " + e.toString());
30
        } catch (Exception e) {
31
            System.out.println();
32
            System.out.println("Exception: " + e.toString());
33
        }
34
    }
35
}
36
/**********************************************************************************************/
37
Error1: 
38
NotBoundException: java.rmi.NotBoundException: MensageiroServer
39-
Erro1: 
39+
40-
Deu merda logo aqui em cima! -> 1
40+
Error2: Changing a little bit the string of LocateRegistry.getRegistry and adding the port "192.168.1.102:1099"
41
42
RemoteException: java.rmi.UnknownHostException: Unknown host: 192.168.1.102:1099; nested exception is: 
43-
Erro2: Mudando um pouco a string de LocateRegistry.getRegistry e adicionando a porta "192.168.1.102:1099"
43+
44
/**********************************************************************************************/
45-
Deu merda logo aqui em cima! -> 1
45+
I'm using Mint, with NetBeans 6.9 and typing java -version in terminal it appears:
46
java version "1.6.0_20"
47
OpenJDK Runtime Environment (IcedTea6 1.9.13) (6b20-1.9.13-0ubuntu1~10.10.1)
48
OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)