Moving applications to a JVM server

If you are running Java™ applications in pooled JVMs, you can move them to run in a JVM server. Because a JVM server can handle multiple requests for Java applications in the same JVM, you can reduce the number of JVMs that are required to run the same workload.

Before you begin

Ensure that the application is threadsafe and is packaged as one or more OSGi bundles. The OSGi bundles must be deployed in a CICS® bundle to zFS and specify the correct target JVMSERVER resource.

The Java developer can use the CICS SDK for Java that is included with CICS Explorer® to repackage a Java application using OSGi. For more information on how to migrate applications that use third party JARs, see Upgrading the Java environment.

About this task

You can either use an existing JVM server or create a JVM server for your application. Do not move an application to a JVM server where the thread limit and usage are already high, because you might introduce locking contentions in the JVM server.

Procedure

  1. Create or update a JVM server:
    • If you decide to create a JVM server, see Configuring a Liberty JVM server. Many of the settings in a JVM profile for a pooled JVM do not apply to JVM servers. The only option that you might want to copy from the pooled JVM profile to the DFHOSGI profile is the LIBPATH_SUFFIX option.
    • If you use an existing JVM server, you might have to increase the THREADLIMIT attribute on the JVMSERVER resource to handle the additional application or update the options in the JVM server profile. If you change the JVM profile, restart the JVM server to pick up the changes.
  2. Create a BUNDLE resource that points to the deployed bundle in zFS.
    When you install the BUNDLE resource, CICS loads the OSGi bundles into the OSGi framework in the JVM server. The OSGi framework resolves the OSGi bundles and registers the OSGi services.
    Use CICS Explorer to check that the BUNDLE resource is enabled. You can also use the OSGi Bundles and OSGi Services views to check the state of the OSGi bundles and services.
  3. Update the PROGRAM resource for the application:
    1. Ensure that the EXECKEY attribute is set to CICS.
      All JVM server work runs in CICS key.
    2. Remove the JVM profile name and enter the name of the JVMSERVER resource.
    3. Ensure that the JVMCLASS attribute matches the OSGi service of the Java application.
    4. Reinstall the PROGRAM resource for the application.
    The PROGRAM resource uses the OSGi service to make an OSGi bundle available to other CICS applications outside the JVM server.

Results

When the Java application is called, it runs in the JVM server.

What to do next

You can use the JVM server view in CICS Explorer and CICS statistics to monitor the JVM server. If the performance is not optimal, adjust the thread limit.