Invoking a Java application in a JVM server

There are many ways to call a Java™ application that is running in a JVM server. The method used will depend upon the characteristics of the JVM server.

About this task

You can invoke a web application running in a Liberty JVM server by using a HTTP request with a specific URL. Web applications cannot be driven directly from EXEC CICS LINK or EXEC CICS START. If you have Java EE applications that are implemented as Plain Old Java Objects (POJOs) and packaged in a WAR or an EAR, you can invoke their business logic components by using EXEC CICS LINK or EXEC CICS START.

To invoke a Java application that is running in an OSGi JVM server, you can either EXEC CICS LINK to a PROGRAM defined by Java, or EXEC CICS START a TRANSACTION that has a target PROGRAM defined by Java. The PROGRAM definition specifies a JVMSERVER, and the name of a CICS® generated OSGi service you want to invoke. Such linkable OSGi services are created by CICS when you install an OSGi bundle that includes a CICS-MainClass header in its manifest. The CICS-MainClass header identifies the main method of the Java class in the OSGi bundle that you want to act as an entry-point to the application.

An OSGi service is a well-defined interface that is registered in the OSGi framework. OSGi bundles and remote applications use the OSGi service to call application code that is packaged in an OSGi bundle. An OSGi bundle can export more than one OSGi service. For more information, see Updating OSGi bundles in an OSGi JVM server.

Invoking Java function in a classpath based JVM server is usually performed as part of a specific capability of a JVM server, such as Batch, Axis2 and SAML. For these capabilities the DFHSJJI vendor interface is provided.

Procedure

  • For a web application developed as a web archive (WAR) file, as an enterprise application archive (EAR) file, or as an enterprise bundle archive (EBA) file containing web application bundle (WAB) files and running in a Liberty JVM server, invoke the application from the client browser by using a URL.
    For more information about invoking business logic components of Java EE applications, see Preparing a Java EE application to be called by a CICS program.
  • For OSGi bundles that are deployed in an OSGi JVM server, follow these steps:
    1. Determine the symbolic name of the active OSGi service that you want to use in the OSGi framework.
      Click Operations > Java > OSGi Services in CICS Explorer® to list the OSGi services that are active.
    2. Create a PROGRAM resource to represent the OSGi service to other CICS applications:
      • In the JVM attribute, specify YES to indicate that the program is a Java program.
      • In the JVMCLASS attribute, specify the symbolic name of the OSGi service. This value is case sensitive.
      • In the JVMSERVER attribute, specify the name of the JVMSERVER resource in which the OSGi service is running.
    3. You can call the Java application in either of two ways:
      • Use a 3270 or EXEC CICS START request that specifies a transaction identifier. Create a TRANSACTION resource that defines the PROGRAM resource for the OSGi service.
      • Use an EXEC CICS LINK request, an ECI call, or an EXCI call. Name the PROGRAM resource for the OSGi service when coding the request.
  • For Axis2 or SAML function, see Configuring a JVM server for Axis2 and Configuring CICS for SAML.

Results

You have created the definition to make your Java application available to other components. When CICS receives the request in the target JVM server, it invokes the specified Java class or Web application on a new CICS Java thread. If the associated OSGi service or Web application is not registered or is inactive, an error is returned to the calling program.