Hi!
I'm trying to do a simple program for RMI. But, I'm getting the following exception while running the line Naming.rebind("interfacename",Remoteserverobject);
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
My Code is as follows:
public static void main(String[] args) throws Exception {
if(System.getSecurityManager()==null)
{
System.setSecurityManager(new RMISecurityManager());
}
Remoteserver objremoteserver=new Remoteserver();
objremoteserver.setmsg("Hello! How are you?");
System.out.println(objremoteserver.getmsg());
try
{
Naming.rebind("Remotemethod", objremoteserver);
System.out.println("Server Started");
}
catch(RemoteException re)
{
System.out.println(re.getLocalizedMessage());
}
finally
{
System.out.println("Unknown Exception Occured!!!!");
}
}
How to overcome this problem. Thanks in advance