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




























