Enabling applications to use a JVM

Just as for non-Java™ applications, CICS® requires that you define the resources needed to run a Java program in a JVM. Also, CICS needs to know where to find the classes that the application will use.

To enable a standard Java program (one that is not a CORBA stateless object or enterprise bean) to use a JVM, you need to:
  1. Select, or create, an appropriate JVM profile for each Java program to use. Choosing a JVM profile and JVM properties file summarizes the considerations you need to take into account, and the changes that you might want to make to the JVM profile.
  2. Check the programming considerations that apply to each of the possible levels of reusability for a JVM: resettable JVMs, continuous JVMs, and single-use JVMs. Ensure that your application design takes these into account, and that you have carried out appropriate testing. Programming for different types of JVM explains the programming considerations.
  3. Set the appropriate Java attributes on the PROGRAM resource definition for the Java program. These attributes specify that the program needs a JVM, what the JVM profile and execution key for that JVM must be, and what the main class in the program is.Setting up a PROGRAM resource definition for a Java program to run in a JVM tells you how to do this.
  4. Add the classes that the application uses to the class paths for the JVM, which are set by using options in the JVM profile and JVM properties file for the JVM. Adding application classes to the class paths for a JVM tells you how to do this.

When you have set up a PROGRAM resource definition for your Java program, and added the application classes to a class path, the Java program is ready to run. Remember that if the JVM profile for the JVM specifies the use of the shared class cache (CLASSCACHE=YES), then for the Java program to run, the shared class cache must be started, or autostart must be enabled so that the shared class cache can be started when the application requests it. Starting the shared class cache tells you how to start the shared class cache or enable autostart.

CORBA stateless objects and enterprise beans do not have a PROGRAM resource definition as such. The PROGRAM resource definition that is relevant to CORBA stateless objects and enterprise beans is that for the request processor program. To enable these applications to use a JVM, you need to:
  1. Identify the JVM profile that is used for the request processor program that will handle the CORBA stateless object or enterprise bean. This is specified on the PROGRAM resource definition for the request processor program. The default request processor program, which is named by the default CIRP transaction on REQUESTMODEL definitions, is DFJIIRP. The supplied PROGRAM resource definition for DFJIIRP specifies the JVM profile DFHJVMCD. If you set up your own request processor program, you can specify a different JVM profile in the resource definition for that program. You do not need to set up any further PROGRAM resource definitions or select any JVM profiles for the individual CORBA stateless objects and enterprise beans. They all use the JVM profile that is specified for the request processor program that handles them. Configuring CICS for IIOP explains how to configure CICS as a CORBA participant, and Setting up an EJB server explains how to set up a CICS EJB server and how to deploy enterprise beans. Both these procedures include setting up a suitable request processor program.
  2. For CORBA stateless objects only, add the JAR file for the application to the shareable application class path, by using the ibm.jvm.shareable.application.class.path system property that will be used by the JVM for the request processor program. If the application uses any classes, such as classes for utilities, that are not included in its JAR file, these classes also need to be added to the shareable application class path. Adding application classes to the class paths for a JVM tells you how to do this.
  3. For enterprise beans, you do not need to add the deployed JAR files (DJARs) for your enterprise beans to the class path. CICS manages the loading of the classes included in these files by means of the DJAR definitions. However, if your enterprise beans use any classes, such as classes for utilities, that are not included in the deployed JAR file, you do need to include these classes on the shareable application class path that will be used by the JVM for the request processor program, as explained in Adding application classes to the class paths for a JVM.