A simple Hello World CICS Java application running in a CICS OSGi JVM server.
- Clone the repository using your IDEs support, such as the Eclipse Git plugin
- or, download the sample as a ZIP and unzip onto the workstation
Tip
Eclipse Git provides an 'Import existing Projects' check-box when cloning a repository.
cics-java-osgi-hello/
- Top-level projectcics-java-osgi-hello-app/
- Java application sourcecics-java-osgi-hello-bundle/
- Build files for CICS bundle projectetc/eclipse_projects/com.ibm.cics.server.examples.osgi.hello.bundle
- Static CICS Bundle Project
The sample includes an Eclipse project configuration, a Gradle build, a Maven POM, and Gradle/Maven Wrappers offering a wide range of build options with the tooling and IDE of your choice.
Choose from the following approach:
- Use the built-in Eclipse and CICS Explorer SDK capability
- Use Eclipse with Buildship (Gradle), or m2e (Maven) to drive Gradle, or Maven.
- Use the command line, or IDE terminal, to drive Gradle or Apache Maven (if installed on your workstation)
- Use the command line, or IDE terminal, or IDE support for Wrappers, to drive the supplied Gradle or Apache Maven Wrappers (with no requirement for Gradle, Maven, Eclipse, or CICS Explorer SDK to be installed)
** Note: ** If you import the project to your IDE, you might experience local project compile errors. To resolve these errors follow the relevant build section below.
The sample comes pre-configured for use with a standard JDK 17 and the CICS TS V6.1 Java EE 9 Target Platform. When you initially import the project to your IDE, if your IDE is not configured for a JDK 17, or does not have CICS Explorer SDK installed with the correct 'target platform' set, you might experience local project compile errors.
To resolve issues:
- ensure you have the CICS Explorer SDK plug-in installed
- configure the Project's build-path, and Application Project settings to use your preferred JDK and Java compiler settings
- set the CICS TS Target Platform to your intended CICS target (Hint: Window | Preferences | Plug-in Development | Target Platform | Add | Template | Other...)
You don't necessarily need to fix the local errors, but to do so, you can run a tooling refresh on the cics-java-osgi-hello-app project. For example, in Eclipse: right-click on "Project", select "Gradle | Refresh Gradle Project".
The CICS JVM server name should be modified in the cics.jvmserver
property in the gradle build cics-java-osgi-hello-bundle/build.gradle to match the required CICS JVMSERVER resource name, or alternatively can be set on the command line (see below).
If you have the Gradle buildship plug-in available, use the right-click Run As... menu on the cics-java-osgi-hello project to configure and run the clean
and build
tasks. Otherwise choose from the command-line approaches.
Gradle Wrapper (Linux/Mac):
./gradlew clean build
Gradle Wrapper (Windows):
gradle.bat clean build
Gradle (command-line):
gradle clean build
Gradle (command-line & setting jvmserver):
gradle clean build -Pcics.jvmserver=MYJVM
A JAR file is created inside the cics-java-osgi-hello-app/build/libs/
directory and a CICS bundle ZIP file inside the cics-java-osgi-hello-bundle/build/distributions
directory.
You don't necessarily need to fix the local errors, but to do so, you can run a tooling refresh on the cics-java-osgi-hello-app project. For example, in Eclipse: right-click on "Project", select "Maven -> Update Project...".
Tip
In Eclipse, Gradle (buildship) is able to fully refresh and resolve the local classpath even if the project was previously updated by Maven. However, Maven (m2e) does not currently reciprocate that capability. If you previously refreshed the project with Gradle or with the CICS Explorer SDK Java Libraries, you'll need to manually remove the 'Project Dependencies' entry on the Java build-path of your Project Properties to avoid duplication errors when performing a Maven Project Update.
The CICS JVM server name should be modified in the <cics.jvmserver>
property in the pom.xml
to match the required CICS JVMSERVER resource name, or alternatively can be set on the command line (see below).
If you have the Maven m2e plug-in available, use the right-click Run As... menu on the cics-java-osgi-hello project to configure and run the clean
and verify
tasks. Otherwise choose from the command-line approaches.
Maven Wrapper (Linux/Mac):
./mvnw clean verify
Maven Wrapper (Windows):
mvnw.cmd clean verify
Maven (command-line):
mvn clean verify
Maven (command-line & setting jvmserver):
mvn clean verify -Dcics.jvmserver=MYJVM
A JAR file is created inside the cics-java-osgi-hello-app/target
directory and a CICS bundle ZIP file inside the cics-java-osgi-hello-bundle/target
directory.
-
Configure an OSGi JVMSERVER.
-
CICS resource definitions for the bundle, programs, transactions and a JVM server are supplied in a group CDEVCJOH as a DFHCSDUP sample input stream supplied in
DFHCSD.txt
. Alternatively they can be installed using the bundle parts supplied with the cics-java-osgi-hello-bundle project. Note that the resource definition for the CICS program CDEVCJOH are not supplied as it will be auto-installed by the processing of @CICSProgram annotation.
- Deploy the CICS bundle project 'com.ibm.cics.server.examples.osgi.hello.bundle' from CICS Explorer using the Export Bundle Project to z/OS UNIX File System wizard. This CICS bundle includes the OSGi bundlepart, the CJOH transaction and the CDEVCJOH program to run the sample.
- Copy and paste the built JAR from your projects/cics-java-osgi-hello-app/target or projects/cics-java-osgi-hello-app/build/libs directory into a new Eclipse CICS bundle project.
- Create a new OSGi bundlepart that references the JAR (OSGi bundle) file.
- Optionally customise the CICS bundle contents, perhaps adding a TRANDEF of your choice
- Right click using the ** Export Bundle Project to z/OS UNIX File System ** wizard.
- Connect to USS on the host system
- Create the bundle directory for the project.
- Copy & paste the built CICS bundle ZIP file from your projects/cics-java-osgi-hello-bundle/target or projects/cics-java-osgi-hello-bundle/build/distributions directory to z/FS on the host system into the bundle directory.
- Extract the ZIP by right-clicking on the ZIP file > User Action > unjar...
- Refresh the bundle directory
- Upload the built CICS bundle ZIP file from your projects/cics-java-osgi-hello-bundle/target or projects/cics-java-osgi-hello-bundle/build/distributions directory to z/FS on the host system (e.g. FTP).
- Connect to USS on the host system (e.g. SSH).
- Create the bundle directory for the project.
- Move the CICS bundle ZIP file into the bundle directory.
- Change directory into the bundle directoy.
- Extract the CICS bundle ZIP file. This can be done using the
jar
command. For example:jar xf file.zip
- Create a new bundle definition, setting the bundle directory to the deployed bundle directory:
BUNDLE(CDEVCJOH) GROUP(CDEVCJOH) BUNDLEDIR(/path/to/bundle/directory)
- Install the bundle
- Definitions > Bundle Definitions
- Right-click > New...
- Fill in the Bundle and Group names as
CDEVCJOH
- Fill in the Bundle Directory to point to the directory you expanded the ZIP
- Install the bundle
Run the CJOH
transaction. This runs the auto-installed CDEVCJOH
program.
This project is licensed under Eclipse Public License - v 2.0.
By downloading, installing, and/or using this sample, you acknowledge that separate license terms may apply to any dependencies that might be required as part of the installation and/or execution and/or automated build of the sample, including the following IBM license terms for relevant IBM components:
• IBM CICS development components terms: https://www.ibm.com/support/customer/csol/terms/?id=L-ACRR-BBZLGX