Loading Order of Custom JAR Files of an Application Server

Loading Order of Custom JAR Files for an Application Server Domain

PeopleTools comes with pre-defined classes, which don't need any additional setup if you need to use them. 

If you want to access third-party Java classes or your own custom Java classes in the PeopleTools environment (that is, access these classes through PeopleCode), you must place the class files in specified locations or include the class files in JAR files in specified locations.

In order to resolve such issues, you need to understand the loading order of jar files associated with an appserver domain.

Understanding the Load Order of Custom JAR Files for an Appserver Domain

When PeopleTools loads the Java Virtual Machine (JVM), it builds a CLASSPATH parameter for the JVM using the below mentioned locations as search order for locating the Java class files:

1. Class files in PS_HOME\class direcotry.
2. Class files in JAR files in the PS_HOME\class directory.
3. Class files in the PS_HOME\appserv\classes directory.
4. Class files in JAR files in the PS_HOME\appserv\classes directory.
5. For each directory listed in the “Add To CLASSPATH” parameter of the psappsrv.cfg configuration file:
   a. Class files in the specified directory.
   b. Class files in JAR files in the specified directory.
6. For each directory listed in the PS_CLASSPATH environment variable:
   a. Class files in the specified directory.
   b. Class files in JAR files in the specified directory.

For example, if PS_CLASSPATH is “dir1;dir2”, the search order for item 6 described previously would be:

Class files in dir1.
   Class files in JAR files in dir1.
Class files in dir2.
   Class files in JAR files in dir2.

PeopleTools uses the -classpath option when it loads the JVM, which overrides the CLASSPATH environment variable.

Hence, it is recommended that you do not use the CLASSPATH environment variable to identify third-party or custom Java classes that you want to access in the PeopleTools environment. 

Oracle recommends using "Add to Classpath" in the psappsrv configuration file instead of using PS_CLASSPATH. If it is really needed to use PS_CLASSPATH then do remember that any directories or jar files specified there will be appended to the end of the classpath given to the JVM.

Note:  Most JVMs cache the class definitions, so, if you update or create custom classes, the JVM won’t pick up the new versions of the class files until you restart the application server. Restarting the appserver will make the JVM reload the updated classes.

Apurva Tripathi
 

>