KickJava   Java API By Example, From Geeks To Geeks.

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


1 // ItemClient.java
2
// mini Client for accessing bean Item
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 ItemClient {
15
16     static Context JavaDoc ctx = null;
17     static ItemHome 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 = "ItemHome";
31     try {
32         home = (ItemHome) PortableRemoteObject.narrow(ctx.lookup(bName), ItemHome.class);
33     } catch(Exception JavaDoc e) {
34         e.printStackTrace();
35         System.exit(2);
36     }
37
38     // ...
39
}
40 }
41
Popular Tags