Bonjour,
Je suis débutante en JAVA RMI. J'essais de réaliser une application qui consiste à ajouter des abonnés à un répértoire téléphonique. Les programmes se compilent , mais dès que j'essais de lancer mon Client, Je tombe sur cette erreur java.long.nullPointerException. Voici le code Client que j'utilise :
import java.rmi.*;
import java.rmi.server.*;
public class Client_Repertoire {
public static void main(String[] args){
try{
Interface_Repertoire biss=(Interface_Repertoire)Naming.lookup("rmi://127.0.0.1:1099/MY");
Abonne F=new Abonne("mery","0613366401");
String a= biss.addAbonne(f);
System.out.println(a);
}
catch(Exception e){System.out.print(e);
}
}
}
Voici l'implémentation de la méthode addAbonne:
import java.rmi.*;
import java.rmi.server.*;
public class Object_Repertoire extends UnicastRemoteObject implements Interface_Repertoire {
Object_Repertoire()throws RemoteException
{
super();
}
int i=0,nmax=3 ;
Abonne A[]=new Abonne[3];
Abonne B;
// Ajout d'un nouvel abonné
public String addAbonne(Abonne a)throws RemoteException
{
if(i<=nmax)
{
A[i].name=a.name;
A[i].tel=a.tel;
i=i+1;
return "true";
}
else return "false";
}
SVP j'ai besoin de votre aide. C'est urgent
