package RMI.Hello;
import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import RMI.Hello.Sample;
public class SampleSever {
public static void main(String args[]) {
try {
//System.setSecurityManager(new RMISecurityManager());
//set the security manager
//create a local instance of the object
Sample hellosample = new SampleImpl();
//local registry
LocateRegistry.createRegistry(1099);
//put the local instance in the registry
Naming.bind("rmi://localhost:1099/SAMPLE-SERVER",hellosample);
System.out.println("Sever Waiting..");
}
catch (java.net.MalformedURLException me) {
System.out.println("Malformed URL: " + me.toString()); }
catch (RemoteException re) {
System.out.println("Remote exception: " + re.toString()); }
catch (AlreadyBoundException e) {
// TODO Auto-generated catch block
System.out.println("No Bound: " + e.toString());
}
}
}