NonStop Server for Java (NSJ) Programmer's Guide (NSJ 2.0+)
Stand-Alone Execution
As in other Java environments, you can run a NonStop
TM
Server for Java program from the command line. The NonStop
TM
Server for Java program must contain a method with this signature:
public static void main(String [] args);
The main() method executes when you use the java command to invoke the Java Virtual Machine (JVM).
No major modifications were made to the JVM standard architecture to enable command-line execution. The JVM runs as a
single executable program named java and performs the standard functions of class loading, linking, verification, and
execution.
Web-Based Execution
A significant Compaq extension of JDK 1.2.2 integrates iTP Secure WebServer with Java by allowing iTP Secure WebServer
to execute Java programs called servlets (see the following figure). Servlets are an alternative to C code and the Pathway CGI
currently provided for users of iTP Secure WebServer. A special Pathway CGI server called ServletServerClass (SSC)
manages the servlets, which inherit the server's manageability, fault tolerance, and scalability.
Relationship of JDK, NonStop
TM
Server for Java, Servlets, and iTP Secure WebServer
Legend
Standard Java Development Kit (JDK)1.
NonStop
TM
Server for Java2.
iTP Secure WebServer3.
Servlets4.
Servlets extend the HttpServlet class and are invoked from within the SSC. The SSC uses the Java Native Interface
(JNI) to run a Java Virtual Machine (JVM) that has been extended by using native RISC methods that can access the Pathway
CGI infrastructure. After starting the JVM, the server invokes the main() method of the HttpServer class, which
initializes itself and waits for a request. A CLASSPATH environment variable is configured with the locations of directories,
zip files, or JAR files from which servlet classes are to be loaded.
HyperText Markup Language (HTML) invokes an instance of an HttpServlet class in much the same way as it invokes
a CGI program. Instead of referring to a program in a cgi-bin directory, HTML refers to SSC-name/Servlet-name.
Return to top of Execution Scenarios.
Invocation From C or C++
The Java Native Interface (JNI) allows C and C++ programs to invoke a Java Virtual Machine (JVM), create Java objects, and
invoke Java methods. NonStop
TM
Server for Java fully supports this usage.