Configuring an OSGi JVM server

Configure the JVM server to run an OSGi framework if you want to deploy Java™ applications that are packaged in OSGi bundles.

About this task

The JVM server contains an OSGi framework that handles the class loading automatically, so you cannot add standard class path options to the JVM profile. The supplied sample, DFHOSGI.jvmprofile, is suitable for an OSGi JVM server. This task shows you how to define a JVM server for an OSGi application from this sample profile.

You can define the JVM server either with CICS® online resource definition or in a CICS bundle in CICS Explorer®.

Procedure

  1. Create a JVMSERVER resource for the JVM server.
    1. Specify a name for the JVM profile for the JVM server.
      On the JVMPROFILE attribute of JVMSERVER, specify a 1 - 8 character name. This name is used for the prefix of the JVM profile, which is the file that holds the configuration options for the JVM server. You do not need to specify the suffix, .jvmprofile, here.
    2. Specify the thread limit for the JVM server.
      On the THREADLIMIT attribute of JVMSERVER, specify the maximum number of threads that are allowed in the Language Environment® enclave for the JVM server. The number of threads depends on the workload that you want to run in the JVM server. To start with, you can accept the default value and tune the environment later. You can set up to 256 threads in a JVM server.
  2. Create the JVM profile to define the configuration options for the JVM server.
    You can use the sample profile, DFHOSGI.jvmprofile, as a basis. This profile contains a subset of options that are suitable for starting the JVM server. All options and values for the JVM profile are described in JVM profile validation and properties. Follow the coding rules, including those for the profile name, in Rules for coding profiles.
    1. Set the location for the JVM profile.
      The JVM profile must be in the directory that you specify on the system initialization parameter, JVMPROFILEDIR. For more information, see Setting the location for the JVM profiles.
    2. Make the following changes to the sample profile:
      • Set JAVA_HOME to the location of your installed IBM® Java SDK.
      • Set WORK_DIR to your choice of destination directory for messages, trace, and output from the JVM server.
      • Set TZ to specify the timezone for timestamps on messages from the JVM server. An example for the United Kingdom is TZ=GMT0BST,M3.5.0,M10.4.0.
    3. Save your changes to the JVM profile.
      The JVM profile must be saved as EBCDIC on the z/OS® UNIX System Services file system.
  3. Install and enable the JVMSERVER resource.

Results

CICS creates a Language Environment enclave and passes the options from the JVM profile to the JVM server. The JVM server starts up and the OSGi framework resolves any OSGi middleware bundles. When the JVM server completes startup successfully, the JVMSERVER resource installs in the ENABLED state.

If an error occurs, for example CICS is unable to find or read the JVM profile, the JVM server fails to start. The JVMSERVER resource installs in the DISABLED state, and CICS issues error messages to the system log.

What to do next

  • Configure the location for JVM logs as described in Controlling the location for JVM output, logs, dumps and trace.
  • Install OSGi bundles for the application in the OSGi framework of the JVM server, as described in Deploying OSGi bundles in a JVM server.
  • Specify any directories that contain native C dynamic link library (DLL) files, such as Db2® or IBM MQ. You specify these directories on the LIBPATH_SUFFIX option in the JVM profile.
  • Specify middleware bundles that you want to run in the OSGi framework. Middleware bundles are a type of OSGi bundle that contains Java classes to implement shared services, such as connecting to IBM MQ and Db2. You specify these bundles on the OSGI_BUNDLES option in the JVM profile.