Salut à tous.
Complètement novice en Java, ça fait 2 jour que j'essaye d'implémenter un serveur rmi
J'ai regardé plusieurs tutos mais rien à faire.
Mon interface :
Mon implémentation :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 package MonPackage; import java.rmi.Remote; import java.rmi.RemoteException; public interface Banzai extends Remote { public String QuelServeurPour(String service) throws RemoteException; }
J'ai beau tourner, retourner le code, j’obtiens toujours l'erreur suivante déclenchée sur le Naming.rebind :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 package MonPackage; import java.rmi.*; import java.rmi.server.*; public class ServeurNomImpl extends UnicastRemoteObject implements Banzai { public ServeurNomImpl() throws RemoteException { super(); } public String QuelServeurPour(String service) throws RemoteException { return "OK"; } public static void main(String[] args) { System.setSecurityManager(new RMISecurityManager()); try{ String nomServ = "NOMBIDON"; Banzai serveur = new ServeurNomImpl(); Naming.rebind(nomServ, serveur); System.out.println("Serveur "+nomServ+ " pret"); } catch(Exception e){ System.out.println("Exception à l'enregistrement : "+ e); System.exit(1); } } }
Exception à l'enregistrement : java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: MonPackage.Banzai
Partager