If you use third-party or custom Java packages in the Java transformation, configure the classpath and at least on class value. The Secure Agent includes the classes and resource files within the classpath when it compiles the Java code
For example, you import the Java package converter in the Java transformation and define the package in converter.jar. You must add converter.jar to the classpath before you compile the Java code. However, if you import the package java.io, you do not need to set the classpath because java.io is a built-in Java package. You do not need to configure the classpath if you use only built-in Java packages.
To make the JAR or class files accessible to the Secure Agent, set the classpath to each JAR file or class file directory associated with the Java package. Separate multiple classpath entries with a semicolon on Windows or a colon on UNIX.
JAR or class files on an advanced cluster
If you use third-party or custom Java packages in the Java transformation in advanced mode, store the JAR or class files in the Secure Agent installation directory.
Store the JAR or class files in the following directory on the Secure Agent machine:
<Secure Agent installation directory>/ext/ctjars
If you use native libraries in a Java transformation on in advanced mode, create the following native-lib and native-bin directories for the .so files and executables, respectively, at the same location as the ctjars directory:
If you update the JAR or class files on the Secure Agent machine, the files take effect the next time you run a job in advanced mode. If the Secure Agent machine stops unexpectedly and the agent restarts on a different machine, add the JAR or class files to the same directory on the new machine.
Note: In production environments, avoid frequent updates to the contents under the ext folder (ctjars, connectors, python, native-lib, native-bin) during workload execution. It can negatively impact long running jobs and cause failures. If necessary, you can set the k8s.infarpm.max.installers=x flag to a higher value than the default of 5, but doing so can cause disk pressure issues on the worker nodes.
If you use a serverless runtime environment, store the files in the supplementary file location. For more information about the supplementary file location, see the Administrator help.
Classpath values
If you use third-party or custom Java packages in the Java transformation, configure at least one classpath value.
You can set the following classpath values:
JVMClassPath property for the Secure Agent
The Secure Agent uses this classpath when you design and validate the Java transformation, run the mapping from the Mapping Designer, or run the mapping task. This classpath applies to all mappings and mapping tasks that run on the agent.
Set the JVMClassPath property for the Secure Agent in Administrator.
Set this property or set the CLASSPATH environment variable on the Secure Agent machine. You do not need to set both classpath values.
CLASSPATH environment variable
The Secure Agent uses this classpath when you design and validate the Java transformation, run the mapping from the Mapping Designer, or run the mapping task. This classpath applies to all mappings and mapping tasks that run on the agent.
Set the CLASSPATH environment variable on the Secure Agent machine.
Set the CLASSPATH environment variable or set the JVMClassPath property for the Secure Agent. You do not need to set both classpath values.
Design time classpath
The Secure Agent uses this classpath when you design and validate the Java transformation and when you run the mapping from the Mapping Designer. This classpath is not used when you run the mapping through a mapping task.
Set the design-time classpath when you want to test the transformation and neither the JVMClassPath property nor the CLASSPATH environment variable contain the required packages. If you configured the JVMClassPath property or the CLASSPATH environment variable to include the required packages, then you do not need to configure the design time classpath.
You configure the design-time classpath in the Java transformation advanced properties.
Java Classpath session property
The Secure Agent uses this classpath when you run the mapping task. This classpath applies only to the mapping task in which the property is set.
Set the Java Classpath session property when you want the classpath to apply to one mapping task but not others. If you configured the JVMClassPath property or the CLASSPATH environment variable to include the required packages, then you do not need to configure the Java Classpath session property.
Set the Java Classpath session property in the advanced session properties of the mapping task.
If you set multiple classpath values, the Secure Agent uses all of the classpaths that apply. For example, you set the JVMClassPath property for the Secure Agent, the CLASSPATH environment variable, and the design time classpath in the Java transformation. When you compile the Java code in the Java transformation or run the mapping through the Mapping Designer, the Secure Agent uses all three classpaths. When you run the mapping through a mapping task, the Secure Agent uses the JVMClassPath and the CLASSPATH environment variable only.
Warning: If you set multiple classpaths, ensure that they do not create multiple copies of a class or resource which can cause runtime errors.
Configuring the JVM Classpath for the Secure Agent
Configure the DTM JVMClassPath property for the Secure Agent on the Secure Agent page in Administrator. The Secure Agent uses this classpath when you design and validate the Java transformation, run the mapping from the Mapping Designer, or run the mapping task. You must restart the Secure Agent after you configure this classpath.
1In Administrator, select Runtime Environments.
2Select the Secure Agent.
3On the Secure Agent page, click Edit.
4In the system configuration details, select the following values:
Option
Value
Service
Data Integration Server
Type
DTM
5In the row for the JVMClassPath property, click Edit.
6Append your classpath to the existing classpath value.
On Windows, use a semicolon (;) to separate classpath entries. On UNIX, use a colon (:).
Note: Do not delete the default value, 'pmserversdk.jar'.
7Click Save.
Restart the Secure Agent after you update the system configuration details.
Configuring the CLASSPATH environment variable
Configure the CLASSPATH environment variable on the Secure Agent machine. The Secure Agent uses this classpath when you design and validate the Java transformation, run the mapping from the Mapping Designer, or run the mapping task. You must restart the Secure Agent after you configure this classpath.
You configure the CLASSPATH environment variable differently on Windows and UNIX.
Configuring the CLASSPATH on Windows
On Windows, you configure the CLASSPATH environment variable from the Advanced System Properties in the Control Panel.
1Open the Advanced System Properties from the Windows Control Panel.
2Click Environment Variables.
3Under System variables, click New.
4Set the variable name to CLASSPATH and the variable value to the classpath.
5Click OK.
Restart the Secure Agent after you configure the environment variable.
Configuring the CLASSPATH on UNIX
On UNIX, you configure the CLASSPATH environment variable from a UNIX shell.
Enter one of the following commands:
- In a UNIX C shell environment, type:
setenv CLASSPATH <classpath>
- In a UNIX Bourne shell environment, type:
CLASSPATH = <classpath> export CLASSPATH
Restart the Secure Agent after you configure the environment variable.
Configuring the design time classpath
Configure the design time classpath in the Java transformation advanced properties. The Secure Agent uses the design time classpath when you design and validate the Java transformation and when you run the mapping from the Mapping Designer.
1Open the mapping that contains the Java transformation.
2Select the Java transformation and click the Advanced Properties tab.
3Enter the classpath in the Design Time Classpath field.
Configuring the Java Classpath session property
Configure the Java Classpath session property in the advanced session properties of the mapping task. The Secure Agent uses this classpath when you run the mapping task.
1Open the mapping task.
2On the Schedule page, scroll down to the advanced session properties, and click Add.
3Under General Options Settings, select Java Classpath.
4Enter the classpath in the Set the Session Property Value field.