锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
Java Application: 浣跨敤eclipse IDE 鍒涘緩銆?br />
棣栧厛錛岃瀵筫clipse榪涜閰嶇疆銆傚繀欏諱笌鏈嶅姟鍣?websphere浣跨敤鐩稿悓鐨凧RE.鍦╡clipse鑿滃崟鏍忎腑閫夋嫨Window,Preferences,鍦ㄥ脊鍑虹獥鍙g殑宸﹁竟閫夋嫨Java,Installed JREs.榛樿鍦幫紝鍙寵竟紿楀彛鐜扮ず瀹夎浜唈re1.5.0.0_07(鍏蜂綋鐗堟湰鍙兘鏈夋墍涓嶅悓)銆傛垜浠渶瑕佹妸瀹冩崲鎴恮ebsphere鐨凧RE.鎶妀re1.5.0.0_07鍓嶉潰鐨勫嬀鍘繪帀錛岀偣鍑籥dd.鍦ㄥ脊鍑虹獥鍙g殑絎笁琛?JRE home directory 閫夋嫨Browse....JRE鐨勮礬寰勪負C:\Program Files\IBM\Rational\SDP\6.0\runtimes\base_v6\java\jre銆傚鏋滀綘娌℃湁瀹夎RAD,灝遍渶瑕佸埌緗戜笂涓嬭澆涓涓狫RE.涓鐩寸偣鍑籓K閫鍥瀍clipse涓葷晫闈€?br />
鍏舵錛岃鍚戝伐紼嬫坊鍔犲繀瑕佺殑JAR銆傚彸鍑誨伐紼嬶紝閫夋嫨Properties-Java Build Path-Add Extenal JARs銆傛坊鍔犲涓嬬殑Jar:wssec.jar,naming.jar,namingclient.jar,sas.jar,ecutils.jar,websphere.jar銆傝繖浜沯ar閮藉彲浠ュ湪C:\Program Fires\Rational\SDP\6.0\runtimes\base_v6\lib鐩綍涓嬫壘鍒般?br />
鎺ョ潃鎴戦棬瑕佹妸sessionbean‘Hello’鐨刪ome鍜宺emote鎺ュ彛鐨?class鏂囦歡鎷瘋鍒癳clipse鐨勫伐紼嬩腑錛屼嬌寰楁垜浠湪宸ョ▼涓彲浠ュ紩鐢ㄥ畠銆?br />
鍏蜂綋紼嬪簭濡備笅錛?br />
public class Test{
public static void main(String[] args) throws NamingException,
RemoteException, CreateException {
Properties properties = System.getProperties();
//鍥犱負瀹㈡埛绔拰sessionbean涓嶆槸榪愯鍦ㄥ悓涓鏈嶅姟鍣ㄤ笂錛岄渶瑕佸properties榪涜閰嶇疆銆?br />
//濡傛灉涓嶆槸鍦ㄥ悓涓鍙扮數鑴戜笂榪愯localhost闇鏀逛負鏈嶅姟鍣ㄧ殑ip鍦板潃鎴栦富鏈哄悕
//900鏄湇鍔″櫒绔彛錛岄粯璁ゅ煎彲鑳芥槸900鎴?809
properties.put(Context.PROVIDER_URL, "iiop://localhost:900");
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
Context ctx = new InitialContext(properties);
Object obj = ctx.lookup("Hello");
HelloHome ejbHome = (HelloHome) javax.rmi.PortableRemoteObject
.narrow(obj, HelloHome.class);
Hello hello= ejbHome.create();
//鐜板湪鎴戜滑鍙栧緱浜嗘墍闇瑕佺殑hello瀵硅薄
}
}