start portlet menu bar

HCLSoftware: Fueling the Digital+ Economy

Display portlet menu
end portlet menu bar
Close
Select Page

Introduction

EJB (Enterprise java bean) is server-side software that helps to summarize the business logic of a particular application. With EJB, we can develop secured, robust, and scalable distributed applications.

A  ZIETrans EJB project provides access to the host interactions that are encapsulated in Integration Objects. It contains one or more Integration Objects. These Integration Objects provide host data to an EJB client, i.e., another ZIETrans application, a user-written Java program, a Web application, or another EJB. A ZIETrans EJB project enables you to separate the collection of the host data from its presentation.

In this blog, we will understand how to use ZIETrans EJB Beans in an application client project.

Using ZIETrans EJB Access Beans with Java application clients

Follow the below steps to use EJB Access Beans with a Java application client:

  1. Create a ZIETrans EJB project that contains one or more macros, Integration Objects, and other resources, and a ZIETrans project. Right-click on the Integration object and export the EJB Access bean to the ZIETrans project as shown below:

Graphical user interface, application Description automatically generated

Figure 1: Export EJB Access bean to ZIETrans Project

2. Create a new Application client project, choose to generate a Main class and a deployment descriptor. Put this new project into the same enterprise archive (EAR file) as the ZIETrans EJB project.

3. Add these jar files as dependent jars in manifest files:

    • The EJB .jar file of the ZIETrans EJB project
    • hatscommon.jar   

4. Move your EJB Access Beans to the application client project.Copy the Integration Object folder that holds the EJB Access Beans from the ZIETrans project to the appClientModule directory of the application client project.

Refer to below screenshot for adding the jars and copying Integration objects.

A screenshot of a computer Description automatically generated

Figure 2: Adding the dependency jars and copying the Integration objects from ZIETrans Project

5. Build your test client in the Main class generated in your application client by implementing the code to instantiate your EJB Access bean and run it.

Refer to below screenshot.

Graphical user interface, text, application Description automatically generated

Figure 3: Instantiate EJB access bean in the Main class

 6. Add the EJB reference and environment variables to the client deployment descriptor:

  1. Open META-INF\application-client.xml.
  2. On the Design tab of the Application Client Descriptor Editor, do the following:
    1. Click Add and choose to add an environment variable:
      • Name: Copy the value of the last part of the HPUBEJB2_REFERENCE string in the EJB Access Bean into this field. For example, it might say HPUBEJB2_REFERENCE1318657356.
      • Type: java.lang.String
      • Value: ejb/ejb_project_name, where ejb_project_name is the name of your ZIETrans EJB project.
    2. Click Add and choose to add an EJB reference:
      • EJB Reference name: ejb /ejb_project_name, where ejb_project_name is the name of your ZIETrans EJB project.
      • EJB Reference type: Session
      • Home: com.ibm.HostPublisher.EJB.HPubEJB2Home
      • Remote: com.ibm.HostPublisher.EJB.HPubEJB2
      • EJB link: ejb_project_name, where ejb_project_name is the name of your ZIETrans EJB project.

Refer to the below screens for more information:

Graphical user interface, application, Word Description automatically generated

Figure 4: Adding EJB Reference name

Graphical user interface, text, application, email Description automatically generated

Figure 5: Adding Environment variable

7. Save the workspace and clean the projects.

Running your application Client on WebSphere Server

  1. Export the Application client project. Right-click the name of the application client project and select Export. Export it as an EAR file.
  2. Copy your EAR file into the bin directory of the WebSphere. In the below location:

          C:\Program Files\ibm\WebSphere\AppServer\bin

3. Install this EAR on the WebSphere server. Open admin console of WAS, and select

Application Types > WebSphere enterprise application > Install. Select next and add both the projects as below:

Graphical user interface, application Description automatically generated

Figure 6: Installing EJB project in WAS

4. Provide the JNDI name as below:

com/ibm/HostPublisher/EJB/EJBProj_name

Graphical user interface, application Description automatically generated

Figure 7: Providing JNDI name

Click next and install on WAS.

5. Open the command prompt and change the directory to bin folder wherever ear has been copied. Run the below command.

launchClient EAR_name -CCBootstrapPort=bootstrap_address_of_ server

Example: launchClient ZIETran_EAR.ear -CCBootstrapPort=2812

Note: The bootstrap address of server can be found at below location.

WebSphere application server > Server > communications > ports.

To understand more about ZIETrans EJB and to create EJB projects, refer to below ZIETrans link:

https://zietrans.hcldoc.com/help/index.jsp

Here is the attached code of application client for reference:

ApplicationClient

Comment wrap
Mainframes | July 22, 2022
Resizable Default Transformation in ZIETrans
Learn how using HCL ZIETrans, you can create a web-based application with an easy-to-use graphical user interface. Learn more about HCL ZIETrans Now!
Mainframes | July 8, 2022
Accessing ZIETrans administrative console on Liberty server
The ZIETrans administrative console allows you to view and change problem-determination settings. It also allows: Select the scope of management, View log and trace files, etc.