6 Configuring EJB Session Bean Bindings
Note:
Support for WebLogic SCA is deprecated in WebLogic Server 14.1.2.0.0.The EJB session bean binding can be applied to both SCA services and SCA references. Configure EJB session bean bindings in the <binding.ejb>
element in the Spring application context file for your application.
-
For general information about configuring the Spring application context configuration for a WebLogic Spring SCA application, see Configuring the Spring Application Context.
-
For the schema that defines the
<binding.ejb>
element, see WebLogic SCA Binding Schema (weblogic-sca-binding.xsd).
Note:
The EJB Binding Component implementation is based on the SCA EJB Session Bean Binding specification at http://www.oasis-opencsa.org/sca-bindings
.
However, in this release of WebLogic SCA, the following features are not supported:
-
Stateful session bean binding (conversations are not supported)
-
<ejb-link>
elements -
Local EJB service binding
-
Local EJB reference binding
This chapter includes the following sections:
binding.ejb Element Attributes
Attributes of the binding.ejb
element are as follows:
name
Optional. Specifies the name of the binding.
uri
Required. For EJB bindings on references, uri
specifies the JNDI name of the target EJB. For EJB bindings on services, the uri
value is the JNDI name at which the EJB is bound.
Advanced CORBA name URIs are not supported. The following two simplified patterns are supported. Both result in the service implementation being bound to the JNDI name ejb/MyHome
:
-
uri="corbaname:rir:#ejb/MyHome"
-
uri="ejb/MyHome"
dispatchPolicy
Optional. Used with service bindings. Specifies the name of a WorkManager to be used for incoming invocations.
Parent topic: Configuring EJB Session Bean Bindings
Binding to Services
When binding.ejb
is configured on an SCA service, an implementation of the service interface becomes available in JNDI when the application is deployed. That service can then be invoked using the EJB programming model. For example, this allows a client to look up and invoke the service as if the underlying service were a deployed EJB. This may be useful in a situation where you want to replace an existing EJB service with an SCA implementation, without requiring clients of the legacy EJB to be updated.
Only the EJB3 programming model is supported for EJB session bean service bindings.
Use the uri
attribute of binding.ejb to specify the JNDI name.
See binding.ejb Element Attributes.
All EJB service bindings are remote and can therefore be looked up and invoked remotely.
Remote service implementations are clusterable. You can configure a client timeout for service bindings. To specify a client timeout, edit the EJBServiceDelegateImplRTD.xml
file located in the binding.ejb
jar file.
EJB service bindings can optionally specify a dispatch policy. To configure a dispatch policy, set the dispatchPolicy
attribute of <binding.ejb>
to the name of the WorkManager to be used for incoming invocations. If the configured WorkManager is not found, a warning is issued at runtime and the default WorkManager is used.
Parent topic: Configuring EJB Session Bean Bindings
Binding to References
When binding.ejb
is configured on an SCA reference, the target EJB is resolved and invoked without any knowledge of the EJB programming model. (WebLogic SCA Runtime determines the programming model of the target EJB based on whether the object returned from the JNDI lookup implements javax.ejb.EJBHome
.)
The target EJB is resolved lazily, that is, it is resolved at runtime as necessary to service an invocation.
This allows an SCA POJO implementation to invoke a deployed EJB in the same way it invokes any other SCA reference. WebLogic SCA Runtime looks up the target EJB from JNDI and delegates any method calls to the EJB. Using binding.ejb
in this way provides the flexibility to replace an EJB service with a non-EJB service without having to update the dependent component implementation.
The EJB2 and EJB3 programming models are supported for reference bindings, as described below.
EJB2 Programming Model
If the target EJB uses an EJB 2.x client view, the binding implementation invokes the home.create()
method to obtain the EJB's remote interface implementation. The binding implementation also translates reference interface method invocations to EJB remote interface invocations.
Methods of the reference interface are mapped to the remote interface according to the rules in SCA EJB Session Bean Binding specification at http://www.oasis-opencsa.org/sca-bindings
.
Parent topic: Binding to References
EJB3 Programming Model
If the EJB3 programming model is used, the target EJB may implement the reference interface, but it is not required to so. If it does not implement the reference interface, the rules in Section 2.2 of the SCA EJB Session Bean Binding specification apply. The EJB binding code is responsible for translating reference interface method invocations to EJB business interface invocations.
Parent topic: Binding to References