编程语言
首页 > 编程语言> > java – 创建供应商中立的EJB3客户端

java – 创建供应商中立的EJB3客户端

作者:互联网

是否可以创建访问EJB3 bean的客户端,客户端不依赖于供应商JAR或配置?我们当前需要支持在WebSphere或JBoss服务器上部署我们的服务的场景,并且客户端在WAS或JBoss上作为应用程序部署,或者作为独立应用程序运行.

我曾经能够使用EJB2.x bean来做到这一点,我只需要使用RMIC创建存根.

但是使用EJB3,如果我要连接到WebSphere,我必须包含瘦客户端JAR,而且我必须使用WAS工具预生成存根.对于JBoss,我必须使用jboss-client.jar.

解决方法:

不,这是不可能的.这已在EJB 3.2规范的第10节中明确说明:

This chapter describes the interoperability support for accessing an
enterprise bean through the EJB 2.1 remote client view from clients
distributed over a network, and the distributed interoperability
requirements for invocations on enterprise beans from remote clients
that are Java Platform, Enterprise Edition (Java EE) components.
Distributed Interoperability is not defined for the EJB 3.x remote client view.

另请注意10.5.5节:

System value classes are serializable value classes implementing the
javax.ejb.Handle, javax.ejb.HomeHandle, javax.ejb.EJBMetaData,
java.util.Enumeration,java.util.Collection, and java.util.Iterator
interfaces. These value classes are provided by the EJB container
vendor. They must be provided in the form of a JAR file by the
container hosting the referenced bean. For interoperability scenarios,
if a referencing component would use such system value classes at
runtime, the Deployer must ensure that these system value classes
provided by the container hosting the referenced bean are available to
the referencing component. This may be done, for example, by including
these system value classes in the classpath of the referencing
container, or by deploying the system value classes with the
referencing component’s application by providing them to the
deployment tool.

对于WebSphere Application Server,EJB瘦客户端包含这些系统值类以及使用CosNaming的IBM JNDI实现.理论上,如果您不需要系统值类,并且您的客户端JVM具有自己的具有CosNaming实现的ORB,则不需要此瘦客户端.

标签:java,ejb-3-0,java-ee,jboss7-x,websphere-7
来源: https://codeday.me/bug/20190831/1772632.html