Invoking an EJB deployed in WAS using Java Client引用一個EJB的部署在使用Java客戶端
EJB’s popularly known as Enterprise Java Beans are one of the state-of-the-art feature of J2EE. EJB技術的通稱企業Java豆是一個國家- - -藝術特色的J2EE 。 EJB’s are mainly used for handling transactions, security, providing remote services etc. Even though lot of Object Relational Mapping Frameworks like Hibernate has replaced EJB’s which is considered to be so heavy in any Enterprise Application. EJB技術的,主要用來處理交易,安全,提供遠程服務等,即使有很多的對象關係映射框架一樣,休眠已取代的EJB的是被視為沉重的,所以在任何企業應用。 Invoking an EJB inside the Application Server Container is quite simple and process is not as tedious when you try to do the same from outside the Application Server.引用一個EJB的內部應用服務器的貨櫃相當簡單的過程是不是繁瑣的當您嘗試做同樣的從外部應用服務器。 Today I am going to explain how to invoke an EJB service which is deployed in a remote machine using a plain java client.今天我要說明如何引用一個EJB的服務,這是部署在遠程機器使用的一種樸素的Java客戶端。
Who are qualified to be the clients? 誰才有資格成為客戶嗎?
EJB clients are those applications, components, systems, and services that try to access the EJB to fulfill a request or get a service. EJB的客戶是那些應用,元件,系統和服務,嘗試訪問EJB的履行請求或得到服務。 The client can be a device client , applet client , stand-alone java clients, EJB clients, CORBA clients, Legacy clients, JMS clients, windows clients and clients from other plat forms.客戶端可以是一個用戶端設備, Applet的客戶端,獨立的Java客戶端,用戶端的EJB , CORBA的客戶,舊客戶端, JMS的客戶, Windows客戶端和客戶從其他平台的形式。 Here I am gonna talk about only stand-alone java clients…在這裡,我在哪裡談,只有獨立的Java客戶…
How java stand- alone client works? 如何Java的立場,獨立的客戶端工程?
Any java application can call an EJB service that is running on a remote application server using RMI calls.任何Java應用程式,可致電EJB的服務是運行在一個偏遠的應用服務器使用RMI的來電。 Since EJB’s internally uses RMI over IIOP.由於EJB技術的內部使用的RMI超過iiop 。
How to access the EJB? 如何訪問EJB的?
To look up an EJB that is remotely deployed, the stand-alone java clients has to make a look-up call through JNDI service running at a part icular port .研究了一個EJB的是遠程部署,立場獨立的Java客戶已作出看看後續呼籲通過JNDI的服務運行的一部分, icular港口。 JNDI is nothing but a naming-service which holds all the “object to name bindings” that JNDI的只是一個命名服務,其中持有的所有“對象名稱綁定”
exists in the server .存在於服務器上。 Once they get the proper handle they can start to invoke the methods from the remote reference obtained using those handle.一旦他們得到適當的處理,他們就可以開始引用的方法,從遠端參考得到使用這些處理。 I am not here to explain the basics; just I have given an overview that ’s all.我無意在此解釋基本知識;剛才我已作出總覽奇摩所有。
How to create an EJB-Client.jar? 如何創建一個EJB的client.jar ?
This is just to tell you how to create ejb-client .jar.這僅僅是告訴你如何創建EJB的客戶端。瓦罐。 What needs to be there?需要採取哪些有?
1. 1 。 EJB Remote Interface EJB的遠程接口
2. 2 。 EJB Home EJB的首頁
3. 3 。 Generated stubs生成的存根
4. 4 。 Necessary class files that can be used to invoke the remote methods.必要的類文件,可用於引用的遠程方法。
5. 5 。 Needed jars.需要罐。
Make the client JAR available to the remote client .使客戶端罐提供給遠程客戶端。 For Web applications, put the ejbclient.jar in the / lib directory.為Web應用程序,把ejbclient.jar ,在/ lib目錄中的目錄。 For non-Web clients, include ejb-client .jar in the client’s classpath.對於非Web客戶端,包括EJB的客戶端。瓦罐在用戶端的classpath下。 All the above said information is as per EJB-specification and from now onwards I am gonna proceed with Websphere specific information.所有上述表示的信息是,作為每EJB的規格,從現在起,我在哪裡進行與WebSphere的具體信息。
Points to be noted for Websphere: 點,須注意的WebSphere :
1 . 1 。 Websphere JNDI Standalone client will only work with the IBM JRE. WebSphere的JNDI的獨立的客戶端將只工作與IBM的JRE 。
2 . 2 。 And IBM does not ship their JRE standalone.和IBM不出貨他們的JRE的獨立。 (at least their 1.4 JRE) (至少他們的1.4的JRE )
Note: You will not face the above said problem in JBOSS and Weblogic. 注意:您會不會面臨上述問題說,在JBoss公司和WebLogic 。 You just have to include the necessary jar that ’s all.你一定要包括必要的罐子說,奇摩所有。
Why things are troubling us? 為什麼事情是困擾我們呢?
That was related to differences in the information used in the IBM orb and others.這是相關的差異,所用的信息,在IBM的ORB的和其他人。 Sun changed the spec to ensure such issues went away.孫改變規格,以確保這些問題到了。 All complying implementations should interoperate out of the box now.所有遵守實現互通應該走出這個框現在。
Process for Accessing the EJB services from Websphere: 進程訪問的EJB服務的WebSphere :
This document provides the guidelines for accessing the Ejb services running in the Websphere Application server from any other external application servers or applications.這份文件提供的指引,進入EJB的服務運行在WebSphere應用服務器從任何其他的外部應用服務器或應用程序。
JAR Collection 罐子收集
To access the Ejb service some of the jar files have to include to the classpath of the application.訪問EJB的服務部分的jar文件必須包括到classpath下的應用程序。 This has to be collected from the Websphere lib directory.這必須從收集到的WebSphere庫目錄。 They are,他們是,
1 . 1 。 bootstrap.jar
2 . 2 。 ecutils.jar
3 . 3 。 ffdc.jar
4 . 4 。 idl.jar
5 . 5 。 iwsorb.jar
6 . 6 。 j2ee.jar
7 . 7 。 lmproxy.jar
8 . 8 。 naming.jar
9 . 9 。 namingclient .jar namingclient 。瓦罐
10 . 10 。 ras.jar
11 . 11 。 sas.jar
12 . 12 。 utils.jar
JRE Collection JRE的收集
The compilation conflict occurs from the versions of the JRE used.彙編發生衝突,從版本的JRE的使用。 As we access the IBM specific classes we need to have IBM jre collection.我們訪問了IBM的具體班級,我們需要有IBM的JRE的收集。 Create jre library from the java folder in the Websphere.創建JRE的圖書館從Java文件夾中的WebSphere 。 And also it is must to use sun jre along with而且,這是必須要使用太陽的JRE隨著
that , and then include the j2ee.jar from sun provided J2SDKEE ( this holds the except ions of Ejb) . ,然後包括j2ee.jar從Sun提供的j2sdkee (此舉行,除離子的EJB ) 。
1. 1 。 IBM jre ( this library has to be created from the whole java directory) IBM公司的JRE (這個圖書館要建立從整個Java的目錄)
2. 2 。 SUN jre ( this library has to be created from jdk not jre)孫的JRE (這個圖書館要建立的JDK的JRE沒有)
3. 3 。 j2ee.jar ( j2sdkee) j2ee.jar ( j2sdkee )
Properties 性能
IBM maintains a property file for establishing connect ions with the iiop. IBM公司保持財產檔案,為建立連接離子與iiop 。 So the application should include that property file.因此,申請應包括財產檔案。 It is named as implfactory.properties這是命名為implfactory.properties
1. 1 。 Implfactory.properties implfactory.properties
Context Parameters 上下文參數
INITIAL_CONTEXT_FACTORY = com.ibm.websphere.naming.WsnInitialContextFactory initial_context_factory = com.ibm.websphere.naming.wsninitialcontextfactory
PROVIDER_URL = iiop: //hostname:2809 provider_url = iiop : / /主機名: 2809




























