Deploying the servlet examples

CICS® loads and runs Java™ applications from zFS, so you must deploy your compiled applications to a directory in zFS that the CICS region can access. You can use the CICS bundle project that is supplied with each servlet example to deploy the application to a Liberty JVM server that is running in CICS. This topic applies to CICS integrated-mode Liberty only.

Before you begin

  • You must create an example web application, as described in Creating the servlet examples.
  • You must have permission to create and install CICS resources in the region.
  • You must install theWebSphere® Application Server Developer Tools OSGi Application Development feature. See Setting up the development environment.
  • For the CICS Java Database Connectivity (JDBC) example, you must have a sample Db2® database available. To deploy this example, you must create and install a DB2CONN CICS resource definition. Ensure that its status is connected. The Db2 plan that is specified in the CICS DB2CONN definition must be bound with a package list specified as follows:
    PKLIST(NULLID.*)

About this task

The preferred method to deploy and install the applications is to use a CICS bundle project. By using this method you can then use CICS facilities to manage those bundle project application resources. A CICS bundle project packages a set of plug-in projects, Dynamic Web Projects, and CICS resources that are logically deployed and managed as a single unit. You can use this method for simple web applications, such as the Hello World example, and more complex web applications, such as the other servlet examples.

An alternative method to deploy and install the applications is to use the Liberty deployment mechanism to deploy WAR or EBA files. You can export the project as a WAR or EBA file and use FTP to copy the file to the dropins directory of a Liberty JVM server. You can use this method for simple web applications, such as the Hello World example.

Procedure

  • Deploying an example by using a CICS bundle project

    To deploy an example by using a CICS bundle project, you can use the IBM® CICS SDK for Java.

    1. Right-click the bundle project and click Export Bundle Project to z/OS UNIX File System.
    2. Click Export to a specific location in the file system and click Next.
    3. Follow the wizard to deploy the bundle to a location in zFS that can be accessed by the CICS region.
      To use the sample BUNDLE resource definitions in the sample group DFH$WLP, use /tmp/cicsts53 as the parent directory on zFS.
      The CICS Explorer® deploys the CICS bundle and the associated projects to zFS. If the CICS bundle includes .osgibundle or .warbundle artifacts, the associated projects are built as specified by their project build properties and are also exported.
      Note: For the CICS Link to Liberty sample, no sample BUNDLE resource is provided. Instead, you must create one. For more information see Deploying a Java EE application in a CICS bundle to a Liberty JVM server.
    4. Edit the sample DFHWLP.jvmprofile to turn on the automatic configuration option with the -Dcom.ibm.cics.jvmserver.wlp.autoconfigure=true system property.
      The server.xml is automatically generated and can be found in the WLP_USER_DIR/servers/server_name directory. You can use the z/OS® UNIX Files view to browse the directory structure to edit the file. You must specify values for -Dcom.ibm.cics.jvmserver.wlp.server.host, and -Dcom.ibm.cics.jvmserver.wlp.server.http.port or -Dcom.ibm.cics.jvmserver.wlp.server.https.port according to your own environment. For the JDBC example, set the -Dcom.ibm.cics.jvmserver.wlp.jdbc.driver.location property to the Db2 JDBC driver location.
      For more information, see Manually configuring a CICS DB2® JDBC type 2 driver data source for Liberty.
      Note: For the CICS Link to Liberty sample, edit your server.xml to add <feature>cicsts:link-1.0</feature> inside the <featureManager> tag.
    5. In the CICSplex Explorer view, select the CICS region where you want to run the servlet examples.
    6. Install the JVMSERVER resource, DFHWLP, which is in the sample group DFH$WLP.
      The sample resource creates a Liberty JVM server in the CICS region.

      The Liberty JVM server creates a directory structure in zFS, including a server.xml file and a dropins directory for web applications. You can check the status of the JVM server by clicking Operations > Java > JVM Servers.

    7. Open the Bundle Definitions view by clicking Definitions > Bundle Definitions.
      This view lists all the bundle definitions for the CICS region.
    8. Install the sample bundle resource definitions in the sample group DFH$WLP.
      Note: For the CICS Link to Liberty sample, you must instead install the bundle definition that you created in Step 3.
      The following table lists the sample bundle resource definitions that are required by the examples.
      Table 1. Sample bundle resource definitions that are required by the servlet examples
      Example Required bundle resource definition
      CICS Hello World example WLPHELLO
      CICS Temporary Storage Queue (TSQ) example WLPTSQ
      CICS Java Database Connectivity (JDBC) example WLPJDBC
      CICS Link to Liberty example User created

      The sample definitions specify /tmp/cicsts53 as the location where the CICS bundles are deployed.

    9. If you have configured the cicsts:security-1.0 feature or are using autoconfigure, ensure that you have also configured the required security rules and configuration elements.
    10. Optional: You might want to change a supplied sample. If you previously deployed the same sample and are now redeploying it, you must disable and re-enable the bundle for the new version of the sample to run.
      The WAR or EBA file (depending on the example) is loaded in the Liberty server and all OSGi bundles are registered in the OSGi framework.
  • Deploying a simple example by using the Liberty deployment mechanism

    To use this method to deploy an example such as Hello World, you must configure and enable a JVM server in CICS. Enabling the JVM server creates the dropins directory.

    1. Edit the DFHWLP.jvmprofile to turn on automatic configuration with the -Dcom.ibm.cics.jvmserver.wlp.autoconfigure=true system property.
      Note: For the CICS Link to Liberty sample, edit your server.xml to add <feature>cicsts:link-1.0</feature> inside the <featureManager> tag.
    2. In the CICSplex Explorer view, select the CICS region where you want to run the servlet example.
    3. Install the JVMSERVER resource, DFHWLP, which is in the sample group DFH$WLP.
      The sample resource creates a Liberty JVM server in the CICS region.

      The Liberty JVM server creates a directory structure in zFS, including a server.xml file and a dropins directory for web applications. You can check the status of the JVM server by clicking Operations > Java > JVM Servers.

    4. In the Resource perspective, right-click the Dynamic Web Project and export it to your local workstation as a WAR or EBA file.
    5. Use FTP to copy the WAR or EBA file to the dropins directory in binary mode.
    6. You can edit the server.xml file to change the host name and the port number.

Results

You deployed a web application that contains servlets and a JSP page to a Liberty JVM server that is running in CICS and configured the Liberty JVM server to use a host name and port number.

What to do next

You can access the web application from a web browser to check the configuration of the Liberty JVM server, as described in Running the servlet examples.