EJBAdapter
The EJB component can be used to access an Enterprise Java Bean hosted in any application server, like Weblogic, for the development and deployment of transactional, distributed object applications-based, server-side software components. The adapter uses EJB 1.1 semantics for accessing the EJB.
Prerequisites
- The EJB client jar needs to be added as a resource to this adapter. Please refer to the Application Server (on which the EJB is deployed) documentation on how this can be done.
- The Initial Context Factory class, specific to the application server being connected to, should also be added as a resource to this adapter. For example, weblogic.jar should be added as a resource if the EJB is deployed in Weblogic application server.
- Only stateless session beans and entity beans are supported. Using this adapter with stateful session beans may not produce the desired results.
- In case of JBOSS application server, log4j-1.2.9.jar present in '$FIORANO_HOME$/extlib/log4j/' has to be updated with the jar from JBOSS installation directory.
Configuration and Testing
Managed Connection Factory Panel
Attributes
Use Connection Details From Input
Parameters to create the connection can be specified in the input message when this property is enabled. If this property is selected and the connection parameters are not given in the input request, then the values given in this panel for those parameters will be used.
Server Configuration
Click the Server Configuration Ellipsis button to configure the server in EjbServerConfig dialog box.
Component Configuration
Application Server
Select the Application Server on which the Enterprise Java Bean is deployed from the drop-down.
Initial Context JNDI
Properties like InitialContextFactory, Provider URL etc. used to create Initial Context should be specified here by clicking on the elipsis and adding entries in the table as shown in figure 3.
For example, to connect to JBoss server (as in Figure 2), the following properties should be added:
- java.naming.factory.initial: org.jnp.interfaces.NamingContextfactory
- java.naming.provider.url: <IP on which the JBoss server is running>:<Port number on which the server is running>
In addition to these, the user may provide other properties depending on the Application Server the component should connect to.
Default Initial Context JNDI values vary depending on the Application Server selected.
Named Configuration
The configuration can be saved for later use by providing a preferred name in the Named Configuration text area. Conversely, a configuration that’s previously saved can be selected from the drop-down.
EJB Home
Fully qualified name of the class which implements the EJBHome interface.
Example: "RemoteCalculator" in case of a Remote Calculator in JBoss.
EJB JNDI Name
JNDI name with which the EJB is bound to the Application Server.
Example: "java:/JBossDeploy//CalculatorBean!RemoteCalculator" in case of the Remote Calculator bean in JBoss.
EJB Create / Finder
After providing EJB Home and EJB JNDI Name properties, click on the ellipsis button to select a method from the list of Create/Finder methods.
If the selected Create/Finder method has any parameters, select the node and click OK to provide those parameters to the method.
Only primitive types can be passed to the Create/Finder methods. Complex data types are not supported.
Connection Pool Params
Please refer the section in Common Configurations page.
Interaction Configurations Panel
Attributes
Is Application Server Available: To fetch the Method.
- Enable this if a connection can be established with the Application Server at the time of CPS configuration. The Remote Methods option is visible in this case.
- Disable this if a connection cannot be established with the Application Server at the time of CPS configuration. The remote Methods option is not visible in this case.
In this case, the details of the Remote Method to be executed should be provided manually, and so options Method Name, Number of Parameters, Parameter types, Return Type are visible.
Remote Methods: Click on the ellipsis button to select the Remote method to be executed from the list of methods.
- Method Name: The name of the Remote Method of the EJB that is to be executed.
- Number of Parameters: The number of parameters that are to be passed to the remote method.
- Parameter Types: Comma-separated, fully qualified class names of the parameters that are to be passed to the remote method.
- Return Type: Fully qualified class name of the return type of the remote method.
In case there are primitive types in Parameter Types and/or Return Type, corresponding wrapper classes should be used.
Functional Demonstration
Configure the EJBAdapter as described in Configuration and Testing section and use feeder and display component to send sample input and check the response respectively.
Input Message
<ns1:hello.Request xmlns:ns1="http://www.fiorano.com/fesb/activity/EJBAdapter1/In"/>
When the property Use Connection details from input is chosen, an additional element 'ConnectionFactorySettings' is added to the input schema, as shown in the figure. Properties that are used to create the connection are present under this element.
Output Message
<?xml version="1.0" encoding="UTF-8"?>
<hello.Response xmlns="http://www.fiorano.com/fesb/activity/EJBAdapter1/Out">
<returnVal xmlns="">Hello World!</returnVal>
</hello.Response>