i m trying to use rmi. The code below is the code that i m using it to bind.
@Override
public void init(String serviceName) throws RemoteException {
/*if(System.getSecurityManager() == null){
System.setSecurityManager(new RMISecurityManager());
}*/
try {
String host = InetAddress.getLocalHost().getHostName();
String url = "rmi://"+ host + "/"+ serviceName;
//String url = "//localhost/" + serviceName;
Naming.rebind(url,this);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
no matter which url i use i m getting the exception below. It never finds the class to marshall. Can someone help me about this issue. Thanks in advance.
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: ceng443.hw3.base.SocialNetworkServer
You need a securitymanager in order to download any code using RMI, but you have it commented out in the fragment you posted. Can you try uncommenting your securitymanager setup?