Adding Classes to the Server Classpath
If you are using your own classes developed by your company or classes from a third-party library, you can control the visibility and loading order of these classes. Class visibility refers to whether the classes and jar files will be or need to be visible to all the classes in Integration Server or to a particular package only.
Classes and jar files that are added to the server classpath are visible to all classes in Integration Server including all Java services. In a sense, the classes and jar file are globally visible.
Note: The visibility of a class may also be restricted to members of the same Java package by omitting the "public" modifier from the class declaration. This is not directly related to class loading and is described in the Java documentation.
There are three ways to add classes and libraries (jar and zip files) to the classpath.
Option 1.Copy jar or zip files to a package's code\jars\static directory.
Integration Server adds the files to the classpath when the package loads.
Note that if you change the contents of a jar file in a package's code\jars\static directory, you must restart Integration Server for the change to take effect. Simply reloading the package is not sufficient.
Option 2. Copy jar or zip files to the
Software AG_directory \
Integration Server_directory \instances\
instanceName\lib\jars\custom directory.
Integration Server adds the files to the classpath when
Integration Server starts.
If you want to add your jar or zip files to the classpath for all Integration Server instances in an installation, copy the files to the Software AG_directory \ Integration Server_directory \lib\jars\custom directory.
Note: For Option 2 for Microservices Runtime, add your jar or zip files to Software AG_directory \ Integration Server_directory \lib\jars\custom
Option 3. Copy files to another location on the file system. Add the path to the jar or class files directory to the watt.server.prepend.classes or watt.server.append.classes properties set in the following file:
Software AG_directory \profiles\IS_instanceName\configuration\custom_wrapper.conf:
If the custom_wrapper.conf file contains overrides to the classpath information, the server uses those settings during startup.
The following table identifies the variables you can use to add directories to the beginning and the end of the Integration Server classpath:
To add directories to the | Edit this variable |
Beginning of the classpath | wrapper.java.additional.202= -Dwatt.server.prepend.classes=
|
End of the classpath | wrapper.java.additional.203= -Dwatt.server.append.classes=
|
For Microservices Runtime, add the path to the jar or class files to: Integration Server_directory /bin/setenv.bat(sh)
The following table identifies the Java system properties that you can set in setenv.bat(sh) to add directories the beginning or end of the classpath for Microservices Runtime.
To add directories to the | Edit this Java system property |
Beginning of the classpath | PREPENDCLASSES in setenv.bat/sh. |
End of the classpath | APPENDCLASSES in setenv.bat/sh. |
For more detailed information about where and how these variables are added to the classpaths, see
Classpaths. For more information about the custom_wrapper.conf and the properties you can set, see
Software AG Infrastructure Administrator's Guide.
Keep the following information in mind when choosing how to add classes and libraries to the classpath.
Options 1 and 2 described above will work only for jar and zip files. Option 3 will work for jar, zip, class, and other files.
Some third-party libraries look in the classpath for configuration or other types of files. Use option 3 to add these files to the classpath.
When option 1 is used, all jar and zip files in a package's code\jars\static directory are automatically included if the package is deployed to another
Integration Server. With options 2 and 3, an additional step is required to deploy the jar, zip or class files.
Where the classes appear on the server classpath affect the loading order. For more information about loading order, see
How Classes Are Found