15/06/11 13:33
sprax_87
Salve, nn sono molto praticata di java e quindi trovo alcune difficoltà a risolvere il seguente problema:
la seguente classe:
package client;
import java.rmi.RemoteException;
import org.example.if1.GetAllRequestMsg;
import org.example.if1.GetAllResponseMsg;
import org.example.if1.GetIdRequestMsg;
import org.example.if1.GetIdResponseMsg;
import org.example.if1.InfoRete;
import org.example.if1.ServiceIF1Stub;
public class PrintToVideoIF1 {
public void PrintGetALL(ServiceIF1Stub c){
GetAllRequestMsg richiesta = new GetAllRequestMsg();
LeggiStringa str = new LeggiStringa();
System.out.println("Inserisci Ip_address_EM:"
richiesta.setIp_address_EM(str.readString());
System.out.println("Inserisci Name_EM:"
richiesta.setName_EM(str.readString());
try {
GetAllResponseMsg res = c.getAll(richiesta);
System.out.println("La lista di InfoRete richiesta è : "
InfoRete[] info=res.getInfoRete();
int p=info.length;
for(int i=0; i<p; i++)
System.out.println(info[i].getName());
System.out.println("L'exitCode generato è = "+res.getExitCode());
}
catch (RemoteException e) {
e.printStackTrace();
}
}
}
Dove InfoRete[] info è un vettore del seguente tipo:
Name_Elm, Location, Role, Indirizzi_ip_n
Dove Name_Elm, Location e Role sono delle stringhe; mentre Indirizzi_ip_n è un ulteriore vettore di stringhe.
Quando compilo il main, in cui viene fatta una chiamata remota al metodo PrintGetALL mi esce il seguente errore:
Exception in thread "main" java.lang.NullPointerException
at client.PrintToVideoIF1.PrintGetALL(PrintToVideoIF1.java:24)
at client.SnodoSclient.main(SnodoSclient.java:17)
Cosa potrebbe essere???????
la seguente classe:
package client;
import java.rmi.RemoteException;
import org.example.if1.GetAllRequestMsg;
import org.example.if1.GetAllResponseMsg;
import org.example.if1.GetIdRequestMsg;
import org.example.if1.GetIdResponseMsg;
import org.example.if1.InfoRete;
import org.example.if1.ServiceIF1Stub;
public class PrintToVideoIF1 {
public void PrintGetALL(ServiceIF1Stub c){
GetAllRequestMsg richiesta = new GetAllRequestMsg();
LeggiStringa str = new LeggiStringa();
System.out.println("Inserisci Ip_address_EM:"
richiesta.setIp_address_EM(str.readString());
System.out.println("Inserisci Name_EM:"
richiesta.setName_EM(str.readString());
try {
GetAllResponseMsg res = c.getAll(richiesta);
System.out.println("La lista di InfoRete richiesta è : "
InfoRete[] info=res.getInfoRete();
int p=info.length;
for(int i=0; i<p; i++)
System.out.println(info[i].getName());
System.out.println("L'exitCode generato è = "+res.getExitCode());
}
catch (RemoteException e) {
e.printStackTrace();
}
}
}
Dove InfoRete[] info è un vettore del seguente tipo:
Name_Elm, Location, Role, Indirizzi_ip_n
Dove Name_Elm, Location e Role sono delle stringhe; mentre Indirizzi_ip_n è un ulteriore vettore di stringhe.
Quando compilo il main, in cui viene fatta una chiamata remota al metodo PrintGetALL mi esce il seguente errore:
Exception in thread "main" java.lang.NullPointerException
at client.PrintToVideoIF1.PrintGetALL(PrintToVideoIF1.java:24)
at client.SnodoSclient.main(SnodoSclient.java:17)
Cosa potrebbe essere???????
aaa