KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > stests > appli > OrderClient


1 // OrderClient.java
2
// mini Client for accessing bean Order
3

4 package org.objectweb.jonas.stests.appli;
5
6 import javax.naming.Context JavaDoc;
7 import javax.naming.InitialContext JavaDoc;
8 import javax.naming.NamingException JavaDoc;
9 import javax.rmi.PortableRemoteObject JavaDoc;
10
11 /**
12  *
13  */

14 public class OrderClient {
15
16     static Context JavaDoc ctx = null;
17     static OrderHome home = null;
18
19     public static void main(String JavaDoc[] arg) {
20
21     // Get InitialContext
22
try {
23         ctx = new InitialContext JavaDoc();
24     } catch (NamingException JavaDoc e) {
25         e.printStackTrace();
26         System.exit(2);
27     }
28
29     // Lookup bean home
30
String JavaDoc bName = "OrderHome";
31     try {
32         home = (OrderHome) PortableRemoteObject.narrow(ctx.lookup(bName), OrderHome.class);
33
34     } catch(Exception JavaDoc e) {
35         e.printStackTrace();
36         System.exit(2);
37     }
38
39     // ...
40
}
41 }
42
Popular Tags