国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

精通ejb(8)

2019-11-18 13:50:01
字體:
來源:轉載
供稿:網友

  精通ejb(8)

例子代碼
rmi-iiop ejb客戶端例子

A java RMI-IIOP client with a PRoprietary EJB server.

package com.wiley.compBooks.roman.corba.helloworld;
import javax.ejb.*;
import javax.naming.*;
import javax.rmi.*;
import java.util.Properties;
import javax.transaction.UserTransaction;
/**
* This class is an example of client code that invokes
* methods on a simple stateless session bean.
*/
public class RMIClient {
public static void main(String[] args) {
try {
/*
* Get System properties for JNDI initialization
*/
Properties props = System.getProperties();
/*
* Use JNDI to look up the home object
*/
Context ctx = new InitialContext(props);
HelloHome home = (HelloHome)
javax.rmi.PortableRemoteObject.narrow(
ctx.lookup("HelloHome"),
HelloHome.class);
/*
* Use JNDI to look up the JTA
* UserTransaction interface
*/
UserTransaction userTran = (UserTransaction)
ctx.lookup("javax.transaction.UserTransaction");
/*
* Start the transaction
*/
userTran.begin();
/*
* Use the home object to create the Hello EJB Object
*/
Hello hello = home.create();
/*
* Call the hello() method, and print it
*/
System.out.println(hello.hello());
/*
* Done with EJB Object, so remove it
*/
hello.remove();
/*
* Commit the transaction
*/
userTran.commit();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Example RMI-IIOP EJB client


A CORBA client with a CORBA-based EJB server.
package com.wiley.compBooks.roman.corba.helloworld;
import java.util.*;
import org.omg.CosNaming.*;
import org.omg.CosTransactions.*;
public class CORBAClient {
public static void main(String[] args) throws Exception {
/*
* Initialize the ORB.
*
* A more portable way to do this is:
*
* Properties p = new Properties();
* p.put("org.omg.CORBA.ORBClass", <..ORB class..>);
* org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, p);
*/
org.omg.CORBA.ORB orb = com.inprise.ejb.Global.orb();
/*
* Get a reference to a naming context
*/
NamingContext context = NamingContextHelper.narrow
(orb.resolve_initial_references("NameService"));
/*
* Look up the home object using COS Naming


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 高青县| 灵寿县| 外汇| 寻甸| 南江县| 灌南县| 武威市| 宁城县| 岳西县| 临潭县| 蒙自县| 攀枝花市| 西城区| 常山县| 土默特左旗| 平阳县| 和龙市| 桐城市| 巩义市| 房产| 嘉禾县| 高淳县| 灵寿县| 平定县| 嘉鱼县| 依兰县| 盖州市| 南岸区| 诏安县| 乌拉特前旗| 涪陵区| 台东市| 德钦县| 平远县| 吴川市| 吴江市| 中江县| 临漳县| 桦南县| 富顺县| 灵川县|