Configure EJB reference bindings. An
EJB reference binding enables SCA components to invoke stateless session
beans.
The following example shows an SCA composite definition
that contains an SCA reference with an EJB binding:
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
targetNamespace="http://www.ibm.com/samples/sca/ejb/jobbank"
name="JobBank">
<component name="CompanyComponent">
<reference name="extEJBService">
<interface.java interface="com.app.resumebank.ResumeBank"/>
<binding.ejb uri="ejb/com/app/resumebank/ResumeBankHome"/>
</reference>
</component>
</composite>
An EJB reference binding supports invocation
of both local and remote stateless session beans.
The binding
URI should be the JNDI name of the stateless session bean which the
SCA reference is trying to invoke. The JNDI name of the session bean
can be in the EJB 2.x or EJB 3.x format based on whether the target
EJB version is 2.x or 3.x. The JNDI name can be local if the target
is a local session bean or remote if the target is remote.
You
do not need to specify an ejb-version attribute under the <binding.ejb>
element for an EJB reference binding.
Also, you do not need
to package the target session bean home interface or client stubs
with an SCA component with an EJB reference binding. The EJB session
bean binding implementation can dynamically look up, create, and invoke
the bean without the usual EJB client classes.
For the SCA reference
interface, use either the target EJB interface or its compatible interface.
Interface compatibility rules are defined under Section 3.1, Compatibility
of Interfaces used for SCA Services & References with EJB Session
Bean Interfaces, of the EJB Session Bean Binding Specification
1.1.
Some of the supported binding uri formats
are in the following list. For binding uri, follow
EJB 2.x or EJB 3.x JNDI lookup name formats based on the target EJB
type.
- Corba url format
<binding.ejb uri="corbaname:iiop:host:port/NameServiceServerRoot#jndi_name"/>
- Local session bean
<binding.ejb uri="ejblocal:jndi_name"/>
- uri based on the topology
Cluster
<binding.ejb uri="cell/clusters/cluster_name/jndi_name" />
Server
<binding.ejb uri="cell/nodes/node_name/servers/server_name/jndi_name" />
Persistent
namespace
<binding.ejb uri="cell/persistent/name_in_persistent_namespace_binding"/>
If the SCA EJB reference binding is
referencing another SCA service with an EJB binding in the same product
cell, you can use the reference
target=componentName/serviceName instead
of the reference binding URI. For example:
<reference name="anotherSCAEJBBindingService" target="SCAEJBServiceComponent/EJBService"/>
If
only one service exists for the service component, you can specify
only the component name for the target and use the reference
target=componentName instead
of the reference binding URI. For example:
<reference name="anotherSCAEJBBindingService" target="SCAEJBServiceComponent"/>