Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop SCA composites > Specify bindings in an SCA environment > Configure EJB bindings in SCA applications


Use EJB bindings in SCA applications in a cluster environment

Use this task to learn how to use 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.

If the service is exposed through an EJB 2 bean, the EJB is bound at:

ejb/sca/ejbbinding/component_name/service_name

For example:

ejb/sca/ejbbinding/CompanyComponent/Company

If the service is exposed through an EJB 3.x bean, the EJB is bound at:

ejb/sca/ejbbinding/component_name/service_name#fullyQualifiedServiceInterfaceNameRemote

For example:

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 "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"
or
uri="corbaname::/NameServiceServerRoot#cell/clusters/cluster1/ejb/session/PriceQuoteSessionFacadeBean"
or
uri="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. We can do this from the admin console:

  1. Click Environment > Naming > Name space bindings.

  2. Select the cell scope.

  3. Click New.

  4. On the Specify binding type page, select the EJB binding type.

  5. 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.

If the composite is running on a v7.0 cell and the target EJB application is running on a v6.1 product, configure a CORBA namespace binding with the correct Corbaname URL of the target EJB. Example Corbaname URL syntax is:

"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.


SCA EJB reference binding URI patterns

Use an EJB reference binding URI pattern that is appropriate for the user setup and configuration:


EJB 3.0 and EJB 3.1 application bindings overview
Configure namespace bindings

+

Search Tips   |   Advanced Search