Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 2 Developing an EJB Reference : Creating and Configuring an EJB Reference

Creating and Configuring an EJB Reference
This section explains how to create and configure an EJB reference in TIBCO Business Studio. For the general procedures and properties of a TIBCO ActiveMatrix reference, refer to the TIBCO ActiveMatrix documentation.
To create and configure an EJB reference, perform the following tasks:
 
Task A Create an ActiveMatrix SOA Project
1.
2.
Select File > New > Project from the Menu. The New Project dialog appears.
3.
Expand the TIBCO SOA Platform folder and select the TIBCO SOA Project item in the Select A Wizard page, then click the Next button, the New TIBCO SOA Project dialog appears.
4.
Check the Use Default Location checkbox to use the default location to store the project.
Uncheck the Use Default Location checkbox, and click the Browse button to specify a location to store the project.
Click the Next button, the Asset Type Selection page appears.
5.
Click the Select All button to select all the asset types to configure for the project, then click the Next button. The Composite Project dialog appears.
6.
Select the Basic SOA Project item in the Project Types area as the project type, then click the Next button. The Composite Details dialog appears to show the composite details.
Keep the default settings for each field, and click the Next button to the Set Special Folders dialog.
Specify the settings as you want for each field, and click the Next button to the Set Special Folders dialog.
7.
8.
After clicking the Finish button, the Open Associated Perspective dialog appears.
Click the Yes button to open the project perspective.
Click the No button to open the project perspective later.
TIBCO Business Studio creates a basic SOA project with a composite containing an abstract component wired to a promoted service and reference.
Task B Create an EJB Reference
1.
a.
Expand project_name > Composites in the Project Explorer panel.
b.
Double-click the project_name.composite item to launch the Composite Editor in the right panel.
c.
As the diagram in Figure 4 shows, the SOA project contains a service that stands on the left side, a component that stands in the middle, and a reference that stands on the right side. You can specify names for each interface.
Figure 4 Opening the Project Composite Editor
2.
a.
b.
Click the Bindings tab, then click the Add Binding button .
c.
Select the EJB Binding item in the List of Bindings as shown in Figure 5, and click the Finish button.
Figure 5 Adding an EJB Binding
Task C Specify the EJB Client JARs
When specifying EJB client JARs, keep the following in mind:
For IBM WebSphere 6.1 and 7, you must specify the EJB client JAR that has WebSphere specific stub classes incorporated, which is created during the process of deploying the EJB JAR into WebSphere.
1.
In the Bindings tab, click the Generate button beside the Client Jars Plug-in field. The Generate WSDL from EJB Client JAR dialog appears as shown in Figure 6.
Right-click the reference in the Composite Editor panel, and select the Generate WSDL from EJB Client JAR... item. The Generate WSDL from EJB Client JAR dialog appears as shown in Figure 6.
Figure 6 Generating WSDL from EJB Client JAR
2.
Select the Generate WSDL from EJB Client JAR radio button, then click the File System... or Workspace... button and browse to the EJB client JAR location, then select the EJB client JAR or any JARs it depends on, and click the Open button.
Figure 6 shows the purchaseorder.jar EJB client JAR selected from the sample distributed with TIBCO ActiveMatrix Binding Type for EJB.
Select the Generate WSDL from Existing EJB Client JAR Project radio button, then click the Browse button to select an existing EJB Client JAR as shown in Figure 7, then click the OK button.
You can only reuse a Java plug-in project used by another reference within the composite. You cannot use a Java plug-in project referenced by another composite.
Figure 7 Selecting an Existing EJB Client JAR
 
3.
After selecting the EJB Client JARs, click the Next button, and the Target EJB Interface dialog appears.
4.
In the right area, all information of EJB component properties are loaded and displayed. This information cannot be changed except the EJB JNDI Name. See Figure 8. Then click the Next button, and the WSDL Generation dialog appears.
Figure 8 Selecting the EJB Target Interface
 
5.
By default, TIBCO Business Studio generates a WSDL file in the Service Descriptors folder and a Java plug-in project named ejbpackagename, which is the name of the EJB package. The EJB client JAR is added to the plug-in project.
For example, Figure 9 shows the WSDL file named PurchaseOrderServiceBean.wsdl and com.tibco.amxext.ejbbinding.sample.purchaseorder.purchaseorderservice plug-in project created when an EJB client JAR purchaseorder.jar is selected. The purchaseorder.jar EJB client JAR contains the EJB interface that defines a purchase order service.
Figure 9 The WDSL File and Plug-in Project
Task D Specify the EJB JNDI Name
After the WSDL file is generated, you need to specify the EJB JNDI name.
1.
2.
Click the EJB reference, then click the Bindings tab in the Properties area.
3.
Expand EJBReference_Binding1 > EJB Interface.
4.
For example, if your EJB Bean’s name is EJB3TestBean, the JNDI name for invoking EJB 3.0 is:
JBOSS: EJB3TestBean/remote
WebSphere: EJB3TestBean
WebLogic: EJB3TestBean#com.tibco.qa.ejbbt.ejb3.EJB3Test
Task E Configure an EJB Reference Connectivity
Before accessing an enterprise bean, an EJB client must obtain a reference to the EJB home object. The EJB client has the JNDI name of the object. Therefore, before invoking operations, the EJB client must look up the JNDI name of the EJB home object in the application server’s JNDI namespace. To enable this lookup, you configure the JNDI context factory and URL for the server that manages namespace in the EJB reference’s connectivity.
To configure these connectivity properties, perform the following steps:
1.
2.
Click the EJB reference, then click the Bindings tab in the Properties panel, and select the EJB binding that you just created.
3.
In the Connectivity area, click the Add button beside the JNDI Driver drop-down list. The Add a JNDI Driver dialog appears. See Figure 10.
Figure 10 JNDI Properties for the WebLogic Application Server
 
4.
In the General tab, select the JNDI driver that you want to add. For example, select the WebLogic application server, then set the values in the JNDI Context URL, User Name, and Password fields. See Adding or Editing JNDI Drivers for more information.
5.
Click the Add JAR... button, browse to the driver JAR location, then open the JAR file you want to add.
Select a driver JAR, and click the Edit JAR... button. You can browse to another JAR location and click OK to replace the selected one.
Select a driver JAR, and click the Remove JAR... button. The selected JAR is removed from the list.
Click the Clear ALL button to remove all the JARs from the list.
Figure 11 shows the WebLogic application server JARs list.
Figure 11 The WebLogic Application Server JARs List
 
6.
After finishing your selection, click the OK button. The JNDI driver that you configured is added to the JNDI Driver drop-down list as shown in Figure 12, and the corresponding properties are shown in the Vendor and Context URL fields.
Figure 12 JNDI Driver Drop-down List
If needed, you can edit the JNDI driver properties by clicking the Edit button beside the JNDI Driver drop-down list.
7.
Task F Test an EJB Reference Connectivity
To ensure that an EJB client can look up the EJB home object, you can test the EJB connectivity properties by clicking the Test Connection button in the Connectivity area. This operation checks that the EJB JNDI Name can be resolved in the JNDI server.
The username and password have been added for security enhancement. When you set the username and password, make sure they are same as those setup in the JNDI driver design-time or setup in the application server.
If you fail to connect to the application server using the username and password for WebLogic 10 security, open the TIBCOBusinessStudio.ini file, then add a line -Dsun.lang.ClassLoader.allowArraySyntax=true. Save the file, then restart TIBCO Business Studio and retest the connectivity.

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved