Java Class Loader policy (JavaClassLoader)

Attach a Java Class Loader policy to one or more JavaCompute nodes in a message flow to define the behavior of the class loaders that are used by the node.

You use a JavaCompute node in a message flow to work with messages by using the Java™ language. The JavaCompute node loads and runs a Java class that is defined as the Java class property on the node. Typically, this class is deployed, along with any other required classes, in a Java archive (JAR) file that is contained in a BAR file. Any Java classes that are deployed in this way are loaded by an integration server-wide class loader. You can override this behavior by using a Java Class Loader policy.

To attach a Java Class Loader policy to a JavaCompute node, set the Java classloader service property of the JavaCompute node to the name of the policy, in the format {policyProjectName}:policyName. You must deploy this policy before the associated message flow is started.

Java Class Loader policies cannot be redeployed while applications and message flows are using them. If you want to change and redeploy this type of policy, you must restart all applications as part of the deploy operation, by specifying the --restart-all-applications parameter on the mqsideploy or ibmint deploy command.

The properties of this policy are described in the following table.
Table 1. Properties of the Java Class Loader policy
Property Property name in .policyxml file Value
JAR files to be loaded includedDeployedJars This property identifies the JAR files that are loaded by the class loader. The JAR files must have been deployed to the integration server.
Set this property to one of the following values:
  • none if no deployed JAR files are to be loaded.
  • automatic (the default) if only the JAR file that contains the class that implements a JavaCompute node is to be loaded. This value is not valid for ESQL, and results in a runtime error.
  • A semicolon-separated list of JAR file names that are to be loaded. The JAR file names must end with .jar. No wildcard characters are supported.

    You can include automatic in the list to also load the JAR file that contains the class that is required by a JavaCompute node. However, if the policy is specified in an ESQL routine, including automatic in the list results in a runtime error.

Java classes in the JAR files that are specified by the JAR files to be loaded property are searched and loaded before classes in the JAR files that are specified by the Shared JAR file path property.

Value type: String

Shared JAR file path sharedJarPath This property specifies the fully qualified file path of a single additional directory to be searched by the class loader. The directory must not be in the work path, as defined by the MQSI_FILEPATH and MQSI_WORKPATH environment variables.

If the directory is specified, it is used to resolve additional classes.

If the directory is not specified, the integration server shared-classes directories are used to resolve additional classes.

Java classes in the JAR files that are specified by the JAR files to be loaded property are searched and loaded before classes in the JAR files that are specified by the Shared JAR file path property.

This property has a default value of automatic.

Value type: String