Using EJB bindings in SCA applications in a cluster environment (deprecated)
Use this task to learn how to use Enterprise JavaBeans (EJB) bindings that are deployed in Service Component Architecture (SCA) applications in a cluster environment.
Service side
When an SCA service is exposed with a binding.ejb element, the service is exposed through an enterprise bean. During deployment, the SCA runtime generates a session bean for the service that is exposed through EJB binding. The caller of the composite service can invoke this service by accessing the generated EJB.ejb/sca/ejbbinding/component_name/service_name
ejb/sca/ejbbinding/CompanyComponent/Company
ejb/sca/ejbbinding/component_name/service_name#fullyQualifiedServiceInterfaceNameRemote
ejb/sca/ejbbinding/CompanyComponent/Company#com.app.jobbank.CompanyRemote
The generated EJB for the composite service will be under profile_root/installedApps/cell_name/composite_name.ear/.
Callers need to include client required classes (such as remote or home) of this generated bean in their classpath (or bundle the classes in their JAR file).
Lookup and invoke of this generated service EJB from
a clustered environment is the same as lookup and invoke of any EJB
in a product clustered setup. Refer to the Naming considerations
in clustered and cross-server environments
in the EJB 3.x
application bindings overview topic.
Reference side
When used on the reference side, the binding.ejb element should specify a URI attribute with values that match the value that is typically used when an EJB client calls the initialContext.lookup() method. The general convention is:"corbaname:iiop:host:port/NameServiceServerRoot#JNDI_name"
where JNDI_name is
the JNDI name of the target EJB.For example:
uri="corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/session/PriceQuoteSessionFacadeBean"
JNDI name syntax differs if the target EJB is an EJB 2 or EJB 3.x bean.
When the referred EJB service is in a different cell, the URI might resemble one of the following:
uri="corbaname:iiop:localhost:2809/NameServiceServerRoot#cell/clusters/cluster1/ejb/session/PriceQuoteSessionFacadeBean"
oruri="corbaname::/NameServiceServerRoot#cell/clusters/cluster1/ejb/session/PriceQuoteSessionFacadeBean"
oruri="cell/clusters/cluster1/ejb/session/PriceQuoteSessionFacadeBean"
if
the target EJB is on the same machine but on different cluster.In advanced scenarios on multiple-server environments, a simpler and more portable way to access the target EJB application from an SCA composite is to set up a namespace binding and use the namespace binding name in the URI attribute of the binding.ejb along with cell/persistent/. For example:
uri="cell/persistent/PriceQuote"
where
PriceQuote is the name
field in the namespace.
The namespace binding can be of type EJB or CORBA based on the advanced scenario.
If the target EJB application which the composite is trying to access is on same cell, but on a different server, node or cluster, configure an EJB namespace binding. You can do this from the administrative console:
- Click .
- Select the cell scope.
- Click New.
- On the Specify binding type page, select the EJB binding type.
- On the Specify basic properties page, specify the binding identifier,
name in namespace, enterprise bean location such as server cluster
or single server (with node), and JNDI name as needed. Use the Name
in name space field to construct the URI as
cell/persistent/name_in_namespace
.
"corbaname:iiop:host:port/NameServiceServerRoot#jndi_name"
After
you configure the namespace binding, use the Name in name
space field to construct the URI; for example, uri="cell/persistent/PriceQuote"
where
PriceQuote is the value in the Name in name space field
of the binding.
An advantage of using a namespace binding is, even when the target EJB changes, the composite definition does not need to change. Only the namespace binding needs to change accordingly.