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
Figure 1: 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 server in EjbServerConfig dialog box.
Figure 2: Server Configuration dialog box
Component Configuration
Application Server
Figure 3: Application Server options
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.
Named Configuration
Please refer From CPS of the component section in Define Named Configuration and utilize EPLCM page for information about saving a configuration or using a saved configuration.
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.
Figure 4: Select Create/Finder method
If the selected Create/Finder method has any parameters,select the node and click OK to provide those parameters to the method.
Figure 5: Pass parameters to the Create/Finder method
Connection Pool Params
Please refer the section in Common Configurations page.
Interaction Configurations Panel
Figure 6: Interaction Configuration 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. Remote Methods option is visible in this case.
- Disable this if a connection cannot be established with Application Server at the time of CPS configuration. Remote Methods option is not visible in this case.
In this case, the details of the Remote Method to be executed should be provide manually, and so options Method Name, Number of Parameters, Parameter types, Return Type are visible.
Figure 7: Method details (for Add operation in Remote Calculator) manually added when Application Server is not available
Remote Methods: Click on the ellipsis button to select the Remote method to be executed from the list of methods.
Figure 8: Select Remote Method
- 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 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.
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.
Figure 9: Demonstrating with sample input and output
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>