I'm currently playing with remote environments using rmi registry. My server is like this:
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class Server {
public static void main(String args[]){
if(args.length");
System.exit(-1);
}
try{
Registry r=LocateRegistry.getRegistry();
MethodsImp methods=new MethodsImp();
//have the object to be remotely accessed so will bind it to the registry
System.out.println("Will register on "+args[0]);
r.rebind(args[0], methods);
}
catch(Exception e){
System.out.println("Something went wrong when registring the methods");
System.out.println(e.getMessage());
System.exit(-1);
}
}
}
When I run the program by:
java -classpath /home/outsider/Desktop/RIM/RIM_TP1_correct/src -Djava.rmi.server.codebase=file:/home/outsider/Desktop/RIM/RIM_TP1_correct/src/ Server regsiter_name
I get this:
Will register on regsiter_name Something went wrong when registring the methods null
For some reason when I used r.rebind it throws an exception which has the message null. Before trying to run the program I install the rmiregistry by doing
rmiregistry &
On the shell. I can't find out what I'm doing wrong. If anyone could help it would be great