SQL/MX 3.2.1 Guide to Stored Procedures in Java (H06.26+, J06.15+)

application. For information about setting the UDR_JAVA_OPTIONS default attribute, see Controlling
JVM Startup Options (page 36).
CAUTION: NonStop SQL/MX does not prevent SPJ methods from spawning other threads. Doing
so is not advised and can lead to unpredictable results.
Class Loaders in an SPJ Environment
For system and extension classes, class loading in the SPJ environment is the same as other Java
environments. By default, SPJ classes, like other Java programs, use the bootstrap class loader to
load system classes, which are typically contained in the rt.jar file and are the Java core API.
SPJ classes use the extension class loader to load classes from standard extension JAR files in the
jre/lib/ext directory.
Class loading in the SPJ environment differs from other Java environments in that the SQL/MX UDR
server manages certain aspects of class loading. The SQL/MX UDR server directs the system class
loader, which typically manages an application's class path, to load classes in the SQL/MX
language manager (mxlangman.jar), and in the JDBC/MX product file (jdbcMx.jar), and in
the HP NonStop SQLJ product file (sqlj.jar), as needed.
The SQL/MX UDR server also creates and assigns one SPJ class loader for each distinct external
path location, which you specify in the EXTERNAL PATH clause of a CREATE PROCEDURE statement
when registering an SPJ. The SPJ class loader assigned to an external path becomes responsible
for loading all SPJ classes in a directory or JAR file specified by that external path and for loading
all application classes that are used by those SPJ classes. The SPJ class loader, instead of the system
class loader, loads application classes from directories and JAR files specified in the class path.
In Figure 6, an SPJ method named myMethod3() in the /usr/myapps/myJar.jar external
path accesses an application class named other.class in the /usr/otherapps class path.
The SPJ class loader for the /usr/myapps/myJar.jar external path loads a copy of
other.class in addition to the class file containing the SPJ method myMethod3().
28 Introduction