01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 2006 Bull S.A.S
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * Initial developer(s):
22: * --------------------------------------------------------------------------
23: * $Id: ClientException.java 8414 2006-06-01 13:57:58Z duvauchn $
24: * --------------------------------------------------------------------------
25: */package org.objectweb.sampleCluster2.client;
26:
27: import java.util.Properties;
28:
29: import org.objectweb.sampleCluster2.ejb.MyEjb1Home;
30: import org.objectweb.sampleCluster2.ejb.MyEjb1;
31: import org.objectweb.sampleCluster2.ejb.MyException;
32:
33: /**
34: * Fat client :
35: * - get an exception
36: */
37: public class ClientException {
38:
39: /**
40: * Private constructor for utility class
41: *
42: */
43: private ClientException() {
44: }
45:
46: /**
47: * Main method
48: * @param args arguments of the client
49: */
50: public static int main(String[] args) {
51:
52: String jonasEJBServer = null;
53: String ejbTotalCallsCount = null;
54: String ejbEntityCreated = null;
55: Properties prop = null;
56:
57: MyEjb1Home home = ClientUtility.getMyEjb1Home();
58: System.out.println("Home retrieved -> " + home);
59: MyEjb1 bean = ClientUtility.getMyEjb1Bean(home);
60: System.out.println("Bean created -> " + bean);
61:
62: try {
63: System.out.println("Throw an exception at the server side");
64: bean.throwMyException();
65: } catch (MyException e) {
66: System.out.println("MyException caught : " + e);
67: } catch (Exception e) {
68: System.out.println("Exception caught : " + e);
69: }
70:
71: System.out.println("Client OK. Exiting.");
72: return 0;
73: }
74: }
|