⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maintest.java

📁 本教程介绍j2ee企业开发方面的知识
💻 JAVA
字号:
/* * * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved. *  * This software is the proprietary information of Sun Microsystems, Inc.   * Use is subject to license terms. *  */// This program tests the enterprise beans from a stand-alone// Java application client.import javax.naming.Context;import javax.naming.InitialContext;import javax.naming.NamingException;import javax.rmi.PortableRemoteObject;import java.rmi.RemoteException;import javax.ejb.CreateException;import com.sun.ebank.ejb.account.AccountControllerHome;import com.sun.ebank.ejb.customer.CustomerControllerHome;import com.sun.ebank.ejb.tx.TxControllerHome;public class MainTest {   public static void main(String[] args) {       CustomerControllerHome customerControllerHome;       AccountControllerHome accountControllerHome;       TxControllerHome txControllerHome;       try {           Context initial;           Object objref;           initial = new InitialContext();           objref = initial.lookup("MyCustomerController");           customerControllerHome =                (CustomerControllerHome)PortableRemoteObject.narrow(objref,                CustomerControllerHome.class);           System.out.println('\n' + "*** CustomerTest ***" + '\n');           new CustomerTest(customerControllerHome.create());           initial = new InitialContext();           objref = initial.lookup("MyAccountController");           accountControllerHome =                (AccountControllerHome)PortableRemoteObject.narrow(objref,                AccountControllerHome.class);           System.out.println('\n' + "*** AccountTest ***" + '\n');           new AccountTest(accountControllerHome.create());           initial = new InitialContext();           objref = initial.lookup("MyTxController");           txControllerHome =                (TxControllerHome)PortableRemoteObject.narrow(objref,                TxControllerHome.class);           System.out.println('\n' + "*** TxTest ***" + '\n');           new TxTest(txControllerHome.create());       } catch (NamingException ex) {           System.err.println("caught NamingException: "  + ex.getMessage());       } catch (RemoteException ex) {           System.err.println("caught RemoteException: "  + ex.getMessage());       } catch (CreateException ex) {           System.err.println("caught CreateException: "  + ex.getMessage());       }   } // main} // class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -