Java shared classloader
The Java shared classloader loads all the JAR files that are located within the shared-classes directories. For integration servers that are associated with an integration node, the precedence order of loading is dictated by the directories in which the JAR files are located. For independent integration servers, the JAR files are placed in the shared-classes directory under the integration server work directory for the integration server.
The way in which the JAR files are loaded depends on whether the integration server is associated with an integration node or is independent of an integration node:
Before you start your integration nodes or integration servers, make sure that the CLASSPATH environment variable is not set, as it can break classloader isolation. If this variable is set, it modifies the Java™ classloader, which takes precedence over all other classloaders, and unexpected issues can occur. IBM® MQ can set the CLASSPATH to contain values that might interfere with JARs that you deploy when you run the setmqenv command.
- Integration servers associated with an integration node:JAR files are loaded in the following precedence order:
- JAR files that are placed in the integration server shared-classes
directory allow only a single defined integration server to access them. Files that are placed in
here are loaded first. No other integration servers can use them.Add the JAR files to the following directory:Ensure that the integration node name, and any integration servers that are created, contain only characters that are valid on your file system. You might also need to create the required directory structure.
- For Windows
workpath\config\<my_int_node_name>\<my_int_server_label>\shared-classes
- For Linux®
workpath/config/<my_int_node_name>/<my_int_server_label>/shared-classes
All files placed into the integration server shared-classes directory that have a .jar extension, are loaded and made available in the Java environment for that integration server. JAR files in this directory take precedence over JAR files in the integration node shared-classes directory.
Note: If the integration server shared-classes directory is empty when the integration server is deleted, the directory is automatically removed. - For Windows
- JAR files that are placed in the integration node shared-classes directory
allow only a single defined integration node to access them. Files that are placed in here are
loaded after any files that are placed in the integration server shared-classes
directory. No other integration node can use them.Add the JAR files to the following directory:
- For Windows
workpath\config\<my_int_node_name>\shared-classes
- For Linux
workpath/config/<my_int_node_name>/shared-classes
Ensure that the integration node name contains only characters that are valid on your file system. You might also need to create the required directory structure.All files placed into the integration node shared-classes directory that have a .jar extension, are loaded and made available in the Java environment for all integration servers in that integration node. JAR files in this directory take precedence over JAR files in the top level shared-classes directory.
Note: If the integration node shared-classes directory is empty when the integration node is deleted, the directory is automatically removed.
- For Windows
- JAR files that are placed in the top level shared-classes directory are
made available to all integration node and all integration servers. Files that are placed in here
are loaded after any files placed in the integration node shared-classes
directory.
Add the JAR files to the following directory:
- For Windows
workpath\shared-classes
- For Linux
workpath/shared-classes
- For Windows
- JAR files that are placed in the integration server shared-classes
directory allow only a single defined integration server to access them. Files that are placed in
here are loaded first. No other integration servers can use them.
- Independent integration servers:
The Java shared classloader loads all the JAR files that are located within the shared-classes directories. JAR files are placed in the shared-classes directory under the integration server work directory for the integration server. For example, if the work directory passed to the IntegrationServer command on startup is /Users/user1/workDir1, the shared-classes directory is /Users/user1/workDir1/shared-classes.
Additional directories can be added to the shared classes search path by using the additionalSharedClassesDirectories setting in the server.conf.yaml file. Individual directories can be added to the path directly:Shared libraries can be referenced by name, which causes all JARs in the named shared library to be loaded by the shared classloader. Shared libraries that are named this way are not usable by applications in the server, as the shared library is reserved for use by the shared classloader. For example:additionalSharedClassesDirectories: '/home/aceuser/generic/extra-classes’additionalSharedClassesDirectories: '{SharedJavaLibrary}'Multiple directories and shared libraries can be added by using the“:”character as a separator. For example:additionalSharedClassesDirectories: '{SharedJavaLibrary1}:{SharedJavaLibrary2}:/home/aceuser/generic/extra-classes'For more information about configuring an integration server by setting properties in the server.conf.yaml file, see Configuring an integration server by modifying the server.conf.yaml file - IBM Documentation.