You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A sample CICS Java application showing use of the `com.ibm.cics.server.invocation.CICSProgram` annotation to link to an Enterprise Java program running in a Liberty JVM server.
3
+
This sample demonstrates a Java EE web application running on a Liberty JVM server in CICS. It provides a web interface to interact with Temporary Storage Queues (TSQs) using the JCICS API.
5
4
6
5
## Contents
7
-
A set of sample components that demonstrate how to annotate a POJO packaged in a WAR (Web application), deploy it to a Liberty JVM server, and then LINK to (or call) that POJO from a CICS program or CICS transaction.
-[cics-java-liberty-link-app](./cics-java-liberty-link-app) - Web application project.
11
-
-[cics-java-liberty-link-bundle](./cics-java-liberty-link-bundle) - CICS bundle plug-in based project, contains Web application and WLPH transaction bundle-parts. Use with Gradle and Maven builds.
12
-
-[etc/eclipse_projects/com.ibm.cics.server.examples.wlp.link.bundle](./etc/eclipse_projects/com.ibm.cics.server.examples.wlp.link.bundle) - CICS Explorer based CICS bundle project, contains Web application and WLPH transaction bundle-parts. Use with CICS Explorer 'Export to zFS' deployment capability.
-[cics-java-liberty-tsq-app](./cics-java-liberty-tsq-app) - Web application project.
9
+
-[cics-java-liberty-tsq-bundle](./cics-java-liberty-tsq-bundle) - CICS bundle plug-in based project, contains Web application. Use with Gradle and Maven builds.
10
+
-[etc/eclipse_projects/com.ibm.cics.server.examples.wlp.tsq.bundle](./etc/eclipse_projects/com.ibm.cics.server.examples.wlp.tsq.bundle) - CICS Explorer based CICS bundle project, contains Web application. Use with CICS Explorer 'Export to zFS' deployment capability.
13
11
-[etc/config/liberty/server.xml](./etc/config/liberty/server.xml) - A template `server.xml` demonstrating the minimum configuration required to run the sample.
14
12
15
13
## Prerequisites
@@ -23,7 +21,7 @@ A set of sample components that demonstrate how to annotate a POJO packaged in a
23
21
## Downloading
24
22
25
23
- Clone the repository using your IDEs support, such as the Eclipse Git plugin
26
-
-**or**, download the sample as a [ZIP](https://github.com/cicsdev/cics-java-liberty-link/archive/main.zip) and unzip onto the workstation
24
+
-**or**, download the sample as a [ZIP](https://github.com/cicsdev/cics-java-liberty-tsq/archive/main.zip) and unzip onto the workstation
27
25
28
26
> [!TIP]
29
27
> Eclipse Git provides an 'Import existing Projects' check-box when cloning a repository.
@@ -63,8 +61,8 @@ You can build the sample in a variety of ways:
63
61
64
62
65
63
> [!IMPORTANT]
66
-
> The sample comes pre-configured for use with a JDK 1.8 and CICS TS V5.5 Libraries for Java EE 6/7. When you initially import the project to your IDE, if your IDE is not configured for a JDK 1.8, or does not have CICS Explorer SDK installed, you might experience local project compile errors. To resolve issues you should configure the Project's build-path to add/remove your preferred combination of CICS TS, JDK, and Liberty's Enterprise Java libraries (Java EE or Jakarta EE). Resolving errors might also depend on how you wish to build and deploy the sample. If you are building and deploying through CICS Explorer SDK and 'Export to zFS' you should edit the link-app's Project properties. Select 'Java Build Path', on the Libraries tab select 'Classpath', click 'Add Library', select 'CICS with Enterprise Java and Liberty' Library, and choose the appropriate CICS and Enterprise Java versions.
67
-
If you are building and deploying with Gradle or Maven then you don't necessarily need to fix the local errors, but to do so, you can do as above, or you can run a tooling refresh on the link-app project. For example, in Eclipse: right-click on "Project", select "Gradle -> Refresh Gradle Project", **or** right-click on "Project", select "Maven -> Update Project...".
64
+
> The sample comes pre-configured for use with a JDK 1.8 and CICS TS V5.5 Libraries for Java EE 8. When you initially import the project to your IDE, if your IDE is not configured for a JDK 1.8, or does not have CICS Explorer SDK installed, you might experience local project compile errors. To resolve issues you should configure the Project's build-path to add/remove your preferred combination of CICS TS, JDK, and Liberty's Enterprise Java libraries (Java EE or Jakarta EE). Resolving errors might also depend on how you wish to build and deploy the sample. If you are building and deploying through CICS Explorer SDK and 'Export to zFS' you should edit the tsq-app's Project properties. Select 'Java Build Path', on the Libraries tab select 'Classpath', click 'Add Library', select 'CICS with Enterprise Java and Liberty' Library, and choose the appropriate CICS and Enterprise Java versions.
65
+
If you are building and deploying with Gradle or Maven then you don't necessarily need to fix the local errors, but to do so, you can do as above, or you can run a tooling refresh on the tsq-app project. For example, in Eclipse: right-click on "Project", select "Gradle -> Refresh Gradle Project", **or** right-click on "Project", select "Maven -> Update Project...".
68
66
69
67
> [!TIP]
70
68
> 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, 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.
@@ -76,14 +74,14 @@ If you are using the Egit client to clone the repo, remember to tick the button
76
74
77
75
### Option 2: Building with Gradle
78
76
79
-
For a complete build you should run the settings.gradle file in the top-level 'cics-java-liberty-link' directory which is designed to invoke the individual build.gradle files for each project.
77
+
For a complete build you should run the settings.gradle file in the top-level 'cics-java-liberty-tsq' directory which is designed to invoke the individual build.gradle files for each project.
80
78
81
-
If successful, a WAR file is created inside the `cics-java-liberty-link-app/build/libs` directory and a CICS bundle ZIP file inside the `cics-java-liberty-link-bundle/build/distribution` directory.
79
+
If successful, a WAR file is created inside the `cics-java-liberty-tsq-app/build/libs` directory and a CICS bundle ZIP file inside the `cics-java-liberty-tsq-bundle/build/distribution` directory.
82
80
83
81
[!NOTE]
84
82
In Eclipse, the output 'build' directory is often hidden by default. From the Package Explorer pane, select the three dot menu, choose filters and un-check the Gradle build folder to view its contents.
85
83
86
-
The JVM server the CICS bundle is targeted at is controlled through the `cics.jvmserver` property, defined in the [`cics-java-liberty-link-bundle/build.gradle`](cics-java-liberty-link-bundle/build.gradle) file, or alternatively can be set on the command line:
84
+
The JVM server the CICS bundle is targeted at is controlled through the `cics.jvmserver` property, defined in the [`cics-java-liberty-tsq-bundle/build.gradle`](cics-java-liberty-tsq-bundle/build.gradle) file, or alternatively can be set on the command line:
For a complete build you should run the pom.xml file in the top-level 'cics-java-liberty-link' directory. A WAR file is created inside the `cics-java-liberty-link-app/target` directory and a CICS bundle ZIP file inside the `cics-java-liberty-link-bundle/target` directory.
105
+
For a complete build you should run the pom.xml file in the top-level 'cics-java-liberty-tsq' directory. A WAR file is created inside the `cics-java-liberty-tsq-app/target` directory and a CICS bundle ZIP file inside the `cics-java-liberty-tsq-bundle/target` directory.
108
106
109
107
If building a CICS bundle ZIP the CICS JVM server name for the WAR bundle part should be modified in the
110
-
`cics.jvmserver` property, defined in [`cics-java-liberty-link-bundle/pom.xml`](cics-java-liberty-link-bundle/pom.xml) file under the `defaultjvmserver` configuration property, or alternatively can be set on the command line.
108
+
`cics.jvmserver` property, defined in [`cics-java-liberty-tsq-bundle/pom.xml`](cics-java-liberty-tsq-bundle/pom.xml) file under the `defaultjvmserver` configuration property, or alternatively can be set on the command line.
Ensure you have the following features defined in your Liberty server.xml:
132
-
*`cicsts:link-1.0`
130
+
*`<feature>servlet-4.0</feature>`
133
131
134
132
A template server.xml is provided [here](./etc/config/liberty/server.xml).
135
133
136
-
### Deploying CICS Bundles with CICS Explorer
137
-
1. Optionally, change the name of the JVMSERVER in the .warbundle file of the CICS bundle project from DFHWLP to the name of your JVMSERVER resource defined in CICS.
138
-
2. Export the bundle project to zFS by selecting 'Export Bundle project to z/OS Unix File System' from the context menu.
139
-
3. In CICS, create a bundle definition, setting the bundle directory attribute to the zFS location you just exported to, and install it.
140
-
4. Check the CICS region for the dynamically created PROGRAM resource HELLOWLP using the Programs view in CICS Explorer, or the CEMT INQUIRE PROGRAM command.
134
+
## Deploying to CICS
141
135
142
-
### Deploying CICS Bundles from Gradle or Maven
143
-
1. Manually upload the ZIP file from the _cics-java-liberty-link-bundle/target_ or _cics-java-liberty-link-bundle/build/distributions_ directory to zFS.
144
-
2. Unzip this ZIP file on zFS (e.g. `${JAVA_HOME}/bin/jar xf /path/to/bundle.zip`).
145
-
3. Create a CICS BUNDLE resource definition, setting the bundle directory attribute to the zFS location you just extracted to, and install it into the CICS region.
146
-
4. Check the CICS region for the dynamically created PROGRAM resource HELLOWLP using the Programs view in CICS Explorer, or the CEMT INQUIRE PROGRAM command.
136
+
### Option 1 - Deploying using CICS Explorer SDK and the provided CICS bundle project
137
+
1. Deploy the CICS bundle project 'com.ibm.cics.server.examples.wlp.tsq.bundle' from CICS Explorer using the **Export Bundle Project to z/OS UNIX File System** wizard. This CICS bundle includes the WAR bundlepart to run the sample.
147
138
148
-
### Deploying directly with Liberty's application configuration
149
-
1. Manually upload the WAR file from the _cics-java-liberty-link-app/target_ or _cics-java-liberty-link-app/build/libs_ directory to zFS.
150
-
2. Add an `<application>` element to the Liberty server.xml to define the web application.
151
-
3. Check the CICS region for the dynamically created PROGRAM resource HELLOWLP using the Programs view in CICS Explorer, or the CEMT INQUIRE PROGRAM command.
152
139
140
+
### Option 2 - Deploying using CICS Explorer SDK with own CICS bundle project
141
+
1. Copy and paste the built WAR from your *projects/cics-java-liberty-tsq-app/target* or *projects/cics-java-liberty-tsq-app/build/libs* directory into a new Eclipse CICS bundle project.
142
+
2. Create a new bundlepart that references the WAR file.
143
+
3. Right click using the ** Export Bundle Project to z/OS UNIX File System ** wizard.
153
144
154
-
## Running
155
145
156
-
If you deployed the sample through CICS Explorer (Export to zFS), or through the CICS bundle plug-in as a ZIP and manually FTP'd the resource to zFS, the sample can be run using the `WLPH` transaction that is provided as a bundlepart within the CICS bundle definition.
146
+
### Option 3 - Deploying using CICS Explorer (Remote System Explorer) and CICS Bundle ZIP
147
+
1. Connect to USS on the host system
148
+
2. Create the bundle directory for the project.
149
+
3. Copy & paste the built CICS bundle ZIP file from your *projects/cics-java-liberty-tsq-bundle/target* or *projects/cics-java-liberty-tsq-bundle/build/distributions* directory to z/FS on the host system into the bundle directory.
150
+
4. Extract the ZIP by right-clicking on the ZIP file > User Action > unjar...
151
+
5. Refresh the bundle directory
157
152
158
-
Alternatively, you can define your own CICS transaction to invoke the program 'HELLOWLP', or you can use the CECI transaction to invoke the sample program:
159
153
160
-
```text
161
-
CECI LINK PROGRAM(HELLOWLP)
162
-
```
154
+
### Option 4 - Deploying using command line tools
155
+
1. Upload the built CICS bundle ZIP file from your *projects/cics-java-liberty-tsq-bundle/target* or *projects/cics-java-liberty-tsq-bundle/build/distributions* directory to z/FS on the host system (e.g. FTP).
156
+
2. Connect to USS on the host system (e.g. SSH).
157
+
3. Create the bundle directory for the project.
158
+
4. Move the CICS bundle ZIP file into the bundle directory.
159
+
5. Change directory into the bundle directoy.
160
+
6. Extract the CICS bundle ZIP file. This can be done using the `jar` command. For example:
161
+
```shell
162
+
jar xf file.zip
163
+
```
163
164
164
-
The program prints a message to the STDOUT output stream of the JVM server it runs on.
165
+
---
165
166
166
-
You can pass a channel with a container:
167
167
168
-
```text
169
-
CECI PUT CONTAINER(NAME) CHAR FROM(MATTHEW) CHANNEL(CHAN)
170
-
CECI LINK PROG(HELLOWLP) CHANNEL(CHAN)
171
-
```
172
-
173
-
(ensure both commands are entered in the same CECI session).
168
+
## Running
174
169
170
+
The servlet is accessed with the following URL: [http://zos.example.com:9080/cics-java-liberty-tsq-app/](http://zos.example.com:9080/cics-java-liberty-tsq-app/).
175
171
172
+
If using Maven/Gradle build and deployment, The servlet is accessed with the following URL: [http://zos.example.com:9080/cics-java-liberty-tsq-app-1.0.0/](http://zos.example.com:9080/cics-java-liberty-tsq-app-1.0,0/).
176
173
177
-
## Find out more
178
-
For more information about invoking Java EE applications in a Liberty JVM server from CICS programs, see [Linking to Java applications in a Liberty JVM server by using the @CICSProgram annotation](https://www.ibm.com/docs/en/cics-ts/latest?topic=djariljs-linking-java-applications-in-liberty-jvm-server-by-using-cicsprogram-annotation).
0 commit comments