Deploying an Enterprise Java application in a CICS bundle to a Liberty JVM server

You can deploy an Enterprise Java application that is packaged as a CICS® bundle in a Liberty JVM server.

Before you begin

The Enterprise Java application, either in the form of web application archive (WAR) files, Enterprise Application Archive (EAR) files, or an Enterprise Bundle Archive (EBA) file, must be deployed as a CICS bundle in zFS. The target JVM server must be enabled in the CICS region.

For more information about creating Java™ applications with the IBM® CICS SDK for Java or IBM CICS SDK for Enterprise Java (Liberty), see Developing applications using IBM CICS SDKs.

For more information about creating Java applications with Gradle or Maven, see Managing Java dependencies using Gradle or Maven.

If you have dependencies on an OSGi bundle that contains a library of common code, install the bundle into the Liberty bundle repository, see Deploying OSGi bundles in a JVM server.

About this task

The CICS application model is to package Java application components in CICS bundles and deploy them to zFS. By installing the CICS bundles, you can manage the lifecycle of the application components.

An Enterprise Java application can contain.
  • One or more WAR files that provide the presentation layer and business logic of the application.
  • An OSGi Application Project, exported to an EBA file. EBA files can contain a web-enabled OSGi Bundle Project to provide the presentation layer and a set of further OSGi bundles that provide the business logic.
  • An EAR file, containing one or more WAR files that provide the presentation layer and business logic.
If you're using CICS Explorer: You can use the IBM CICS SDK for Enterprise Java (Liberty) in CICS Explorer to deploy bundles by following instructions in this topic.
If you're using Gradle or Maven: You can package and deploy applications in CICS bundles by using the CICS-provided Gradle or Maven plug-in, provided the CMCI JVM server is configured to use the How it works: CICS bundle deployment API CICS bundle deployment API.

This tutorial provides step-by-step instructions on how to build a CICS bundle from an existing Java application that is already built by Gradle or Maven.

Procedure

  1. Create a BUNDLE resource that specifies the directory of the bundle in zFS. Creating a BUNDLE resource causes all associated BUNDLEPARTs to be installed.
    When a WAR, EAR or EBA BUNDLEPART is installed into a Liberty JVM server, an application element is added to the ${server.config.dir}installedApps.xml, and the application file is copied from the BUNDLEDIR into the ${server.config.dir}/installedApps directory. A BUNDLE resource can be created through the following interfaces.
    1. In the CICS SM perspective in CICS Explorer, click Definitions > Bundle Definitions in the CICS Explorer menu bar to open the Bundles Definitions view.
    2. Right-click anywhere in the view and click New to open the New Bundle Definition wizard.
      Enter the details for the BUNDLE resource in the wizard fields.
    3. Install the BUNDLE resource.
  2. Optional: Enable the BUNDLE resource to start the Enterprise Java applications in the Liberty server, if the resource was created in the DISABLED state. When the bundle is ENABLED, the Liberty application is started.
  3. Inquire the BUNDLE resource to check the state of the bundle resource.
    • When the BUNDLE resource is in an ENABLING state, CICS is starting all the resources in the bundle. The BUNDLE remains in an ENABLING state when one or more Liberty applications included in the bundle are still installing or starting.
    • When the BUNDLE resource is in an ENABLED state, CICS started all the resources in the bundle successfully and all Liberty applications that are included in the bundle start.
    • When the BUNDLE is in a DISABLING state, CICS is stopping all the resources in the bundle. The BUNDLE remains in a DISABLING state when one or more Liberty applications included in the bundle are still stopping.
    • When the BUNDLE resource is in a DISABLED state, CICS stopped all resources in the bundle, or detected that one or more of the Liberty applications stopped. When a BUNDLE moves from an ENABLING state into a DISABLED one, a Liberty application in the bundle might of failed to start, or the application did not install in Liberty before the timeout. The timeout is configured by the JVM system property com.ibm.cics.jvmserver.wlp.bundlepart.timeout.
    1. In CICS Explorer, click Operations > Bundles in the CICS Explorer menu bar to open the Bundles view. Check the state of the BUNDLE resource.
    If the BUNDLE resource failed to install in the enabled state, check the bundle parts for the BUNDLE resource. If any of the bundle parts are in the UNUSABLE state, a message is issued to explain the cause of the problem. For example, this state can indicate that a problem with the CICS bundle in zFS, or the associated JVMSERVER resource is not available. You must discard the BUNDLE resource, resolve the reported issue, and then install the BUNDLE resource again.
  4. Optional: To run Enterprise Java application requests on an application transaction, you can create URIMAP and TRANSACTION resources.
    Defining a URI map is useful if you want to control security to the application, because you can map the URI to a specific transaction and use transaction security. Typically, these resources are created as part of the CICS bundle and are managed with the application. However, you can choose to define these resources separately if preferred.
    1. Create a TRANSACTION resource for the application that sets the PROGRAM attribute to DFHSJTHP.
      This CICS program handles the security checking of inbound Enterprise Java requests to the Liberty JVM server. If you set any remote attributes, they are ignored by CICS because the transaction must always attach in the local CICS region.
    2. Create a URIMAP resource that has a USAGE type of JVMSERVER. Set the TRANSACTION attribute to the name of the application transaction and set the SCHEME attribute to HTTP or HTTPS.
      You can also use the USERID attribute to set a user ID. This value is ignored if the application security authentication mechanisms are used. If no authentication occurs and no user ID is set on the URI map, the work runs under CICS default user ID.

Results

The CICS resources are enabled, and the Enterprise Java applications are successfully installed into the Liberty JVM server.

What to do next

You can test that the Java application is available through a web client. To update or remove the application, see Administering Java applications.