First RMI Program
I have written a simple program for server and client .When
i run the program it is showing the error
The code for the server is
public class CustWorkImpl implements CustWork {
public CustWorkImpl() throws RemoteException {
UnicastRemoteObject.exportObject(this);
}
public String getSvrMsg() throws RemoteException {
String threadName = Thread.currentThread().getName();
String currTime = Calendar.getInstance().getTime().toString();
System.out.println(threadName + "A Client Connected At: " + currTime);
return (threadName + "A Client Connected At: " + currTime);
}
public static void main(String args[]) {
try {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
CustWorkImpl impl = new CustWorkImpl();
Naming.rebind("workObj", impl);
System.out.println("Server is Waiting");
} catch (Exception ex) {
ex.printStackTrace();
System.out.println(ex);
}
}
}
java.security.AccessCont********************ception: access denied (java.net.SocketPermission 127.0.0.1:9000 connect,resolve)
what should be done to resolve this.
|