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
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.
4
+
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.
5
5
6
6
## Contents
7
-
This is a set of sample Eclipse projects for Link to Liberty, demonstrating how you can annotate a POJO packaged in a WAR in a Liberty JVM server, to allow it be called from a CICS program.
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.
8
8
9
-
-[cics-java-liberty-link-app](./cics-java-liberty-link-app) - Web project
10
-
-[cics-java-liberty-link-bundle](./cics-java-liberty-link-bundle) - CICS bundle project with Web app and WLPH transaction as bundle parts.
-[cics-java-liberty-link-app](./cics-java-liberty-link-app) - Web 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.
13
+
-[etc/config/liberty/server.xml](./etc/config/liberty/server.xml) - A template `server.xml` demonstrating the minimum configuration required to run the sample.
13
14
14
15
## Prerequisites
15
-
* CICS TS V5.5 or later
16
-
* Java SE 1.8 or later on the workstation
17
-
* Eclipse with the IBM CICS SDK for Java EE, Jakarta EE and Liberty, or any IDE that supports usage of the Maven Central artifact [com.ibm.cics:com.ibm.cics.server.](https://search.maven.org/artifact/com.ibm.cics/com.ibm.cics.server)
18
-
* Either Gradle or Apache Maven on the workstation
16
+
- CICS TS V5.5 or later
17
+
- Java SE 1.8 or later on the workstation
18
+
- One of the following:
19
+
- Eclipse with the IBM CICS SDK for Java EE, Jakarta EE and Liberty
20
+
- An IDE of your choice that supports Gradle or Maven
21
+
- A command line version of Gradle or Apache Maven on the workstation
19
22
20
23
## Downloading
21
24
@@ -27,7 +30,7 @@ This is a set of sample Eclipse projects for Link to Liberty, demonstrating how
27
30
28
31
### Check dependencies
29
32
30
-
Before building this sample, you should verify that the correct CICS TS bill of materials (BOM) is specified for your target release of CICS. The BOM specifies a consistent set of artifacts, and adds information about their scope. In the example below the version specified is compatible with CICS TS V5.5 with JCICS APAR PH25409, or newer. That is, the Java byte codes built by compiling against this version of JCICS will be compatible with later CICS TS versions and subsequent JCICS APARs.
33
+
If you are building this sample with Gradle or Maven you should verify that the correct CICS TS bill of materials (BOM) is specified for your target release of CICS. The BOM specifies a consistent set of artifacts, and adds information about their scope. In the example below the version specified is compatible with CICS TS V5.5 with JCICS APAR PH25409, or newer. That is, the Java byte codes built by compiling against this version of JCICS will be compatible with later CICS TS versions and subsequent JCICS APARs.
31
34
You can browse the published versions of the CICS BOM at [Maven Central.](https://mvnrepository.com/artifact/com.ibm.cics/com.ibm.cics.ts.bom)
32
35
33
36
Gradle (build.gradle):
@@ -52,25 +55,31 @@ Maven (POM.xml):
52
55
53
56
## Building
54
57
55
-
You can build the sample using an IDE of your choice, or you can build it from the command line. For both approaches, using Gradle or Maven is the recommended way to get a consistent version of build tooling.
58
+
You can build the sample in a variety of ways:
59
+
- Using the implicit compile/build of the Eclipse based CICS Explorer SDK
60
+
- Using the built-in Gradle or Maven support of your IDE (For example: *buildship* or *m2e* in Eclipse which integrate with the "Run As..." menu.)
61
+
- or you can build it from the command line with Gradle or Maven
56
62
57
-
For an IDE, taking Eclipse as an example, the plug-ins for Gradle *buildship* and Maven *m2e* will integrate with the "Run As..." capability, allowing you to specify a specific version of your chosen build tool.
58
63
59
-
> [!NOTE]
60
-
> If you import the project to your IDE, you might experience local project compile errors. To resolve these errors you should run a tooling refresh on that project. For example, in Eclipse: right-click on "Project", select "Gradle -> Refresh Gradle Project", **or** right-click on "Project", select "Maven -> Update Project...".
64
+
> [!IMPORTANT]
65
+
> When you initially import the project to your IDE, you might experience local project compile errors. Resolving these errors depends on how you wish to build and deploying 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.
66
+
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 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...".
61
67
62
68
> [!TIP]
63
69
> 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.
64
70
65
-
### Eclipse
71
+
### Building with Eclipse
66
72
67
-
Import the projects into CICS Explorer using File → Import → General → Existing projects into workspace.
68
-
> [!NOTE]
69
-
> If using the egit client, you can just clone the repo and tick the button to import all projects.
73
+
If you are using the Egit client to clone the repo, remember to tick the button to import all projects. Otherwise, you should manually Import the projects into CICS Explorer using File → Import → General → Existing projects into workspace, then follow the error resolution advice above.
70
74
71
75
### Building with Gradle
72
76
73
-
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.
77
+
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.
78
+
79
+
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.
80
+
81
+
[!NOTE]
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.
74
83
75
84
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:
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-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.
97
106
98
107
If building a CICS bundle ZIP the CICS JVM server name for the WAR bundle part should be modified in the
99
108
`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.
@@ -123,9 +132,9 @@ Ensure you have the following features defined in your Liberty server.xml:
123
132
A template server.xml is provided [here](./etc/config/liberty/server.xml).
124
133
125
134
### Deploying CICS Bundles with CICS Explorer
126
-
1.Change the name of the JVMSERVER in the .warbundle file of the CICS bundle project from DFHWLP to the name of the JVMSERVER resource defined in CICS.
135
+
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.
127
136
2. Export the bundle project to zFS by selecting 'Export Bundle project to z/OS Unix File System' from the context menu.
128
-
3.Create a bundle definition, setting the bundle directory attribute to the zFS location you just exported to, and install it.
137
+
3.In CICS, create a bundle definition, setting the bundle directory attribute to the zFS location you just exported to, and install it.
129
138
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.
130
139
131
140
### Deploying CICS Bundles from Gradle or Maven
@@ -134,15 +143,17 @@ A template server.xml is provided [here](./etc/config/liberty/server.xml).
134
143
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.
135
144
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
145
137
-
### Deploying with Liberty configuration
146
+
### Deploying directly with Liberty's application configuration
138
147
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.
139
148
2. Add an `<application>` element to the Liberty server.xml to define the web application.
140
149
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.
141
150
142
151
143
152
## Running
144
153
145
-
You can use the CECI transaction to invoke the sample program:
154
+
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.
155
+
156
+
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:
146
157
147
158
```text
148
159
CECI LINK PROGRAM(HELLOWLP)
@@ -159,7 +170,7 @@ CECI LINK PROG(HELLOWLP) CHANNEL(CHAN)
159
170
160
171
(ensure both commands are entered in the same CECI session).
161
172
162
-
Alternatively, the enterprise Java program can be run using the provided `WLPH` transaction.
173
+
163
174
164
175
## Find out more
165
176
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