The Java Program: AuthServer.java
1 import AuthRemoteObject;
2 import java.net.MalformedURLException;
3 import java.rmi.ConnectException;
4 import java.rmi.RemoteException;
5 import java.rmi.Naming;
6
7 public class AuthServer {
8
9 private final static String service_name = "authenticate";
10
11 public static void main (String args[]) {
12 try {
13 AuthRemoteObject ro = new AuthRemoteObject ();
14 final String url = "//"+args[0]+":"+args[1]+"/"+service_name;
15 Naming.rebind (url, ro);
16 System.out.println ("Added an identity object to the registery");
17 } catch (MalformedURLException e) {
18 e.printStackTrace();
19 } catch (ConnectException e) {
20 System.err.println ("Is the registry running?");
21 e.printStackTrace();
22 } catch (RemoteException e) {
23 e.printStackTrace();
24 }
25 }
26 }