01: // ItemClient.java
02: // mini Client for accessing bean Item
03:
04: package org.objectweb.jonas.stests.appli;
05:
06: import javax.naming.Context;
07: import javax.naming.InitialContext;
08: import javax.naming.NamingException;
09: import javax.rmi.PortableRemoteObject;
10:
11: /**
12: *
13: */
14: public class ItemClient {
15:
16: static Context ctx = null;
17: static ItemHome home = null;
18:
19: public static void main(String[] arg) {
20:
21: // Get InitialContext
22: try {
23: ctx = new InitialContext();
24: } catch (NamingException e) {
25: e.printStackTrace();
26: System.exit(2);
27: }
28:
29: // Lookup bean home
30: String bName = "ItemHome";
31: try {
32: home = (ItemHome) PortableRemoteObject.narrow(ctx
33: .lookup(bName), ItemHome.class);
34: } catch (Exception e) {
35: e.printStackTrace();
36: System.exit(2);
37: }
38:
39: // ...
40: }
41: }
|