uCosminexus Application Server, Web Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

2.5.2 Methods for performing JSP pre-compilation

The following are two methods for performing JSP pre-compilation:

This subsection provides an overview of the commands used for JSP pre-compilation and explains the compilation method. Note that the compilation method depends upon stages for pre-compiling the JSP files. For details on the applicable stages for JSP pre-compilation and compilation method, see 2.5.3 Examples of applying JSP pre-compilation.

Organization of this subsection
(1) Overview of commands
(2) JSP pre-compilation with the cjjspc command
(3) JSP pre-compilation when a J2EE application is started by the cjstartapp command

(1) Overview of commands

This subsection explains the preconditions for implementing the JSP pre-compilation, the files required during execution of the JSP pre-compilation and the files generated after executing JSP pre-compilation:

Preconditions
To implement JSP pre-compilation, it is assumed that the JSP files to be compiled are stored under the Web application root directory or under the sub directory.

Files required for JSP pre-compilation
The following files are required for implementing JSP pre-compilation:
  • JSP files (JSP 1.1, JSP 1.2, JSP 2.0, or JSP 2.1)#1
  • Tag files compliant with JSP 2.0 specifications or JSP 2.1 specifications
  • Files that are statically included from the JSP files and the tag files
  • TLD file#2
  • web.xml#2#3
  • Class library necessary for compilation
#1 JSP files implies the following files:
  • Files with .jsp or .jspx extension (.jspx is only in the case of JSP 2.0 or later)
  • Files specified in <jsp-file> tag of web.xml
  • Files matching with <jsp-property-group><url-pattern> tag of web.xml (only in the case of JSP 2.0 or later)
#2 Whether the tag files conform to the DTD or XML schema during execution of JSP pre-compilation is verified.
#3 If web.xml does not exist, the compilation is executed assuming the Web application version to be version 3.0.

Files generated after JSP pre-compilation JSP compilation results)
The Java source files and the class files generated from the JSP files and the tag files are called JSP compilation results. When you implement JSP pre-compilation, the following JSP compilation results are generated in the JSP working directory.
  • The Java source files and class files generated from the JSP files
  • The Java source files and class files generated from the tag files
Note that during the execution of the JSP pre-compilation, you can specify whether to save the Java source files.

(2) JSP pre-compilation with the cjjspc command

The cjjspc command is used to implement JSP pre-compilation. If you implement this command during development of an application, you can compile the JSP files contained in a Web application. JSP pre-compilation with the cjjspc command includes the following two methods:

You can specify the following contents during execution of the cjjspc command:

Note that these settings are specified with command options. For details on the usage of the JSP pre-compilation command (cjjspc command), see cjjspc (JSP pre-compilation) in the uCosminexus Application Server Command Reference Guide.

Note
Changing the JavaVM runtime options
If you set the environment variable CJ_CMD_JVM_ARGS, you can change the JavaVM runtime options operated by the cjjspc command.
By default, -Xmx512m (maximum value of Java heap memory area is 512 MB) is specified in the JavaVM runtime option. When you want to compile large-scale Web applications using the cjjspc command, the maximum value of the Java heap memory area might exceed and java.lang.OutOfMemoryError might occur. Therefore, when compiling large-scale Web applications, you must specify the appropriate Java heap memory area in the environment variable CJ_CMD_JVM_ARGS in advance.
Reference note
  • When performing the JSP pre-compilation with the cjjspc command, if an error occurs during translation of the JSP files or the tag files, error messages are output. An error message is output to the console.
  • When the command is executed, the log is output in the standard output or standard error output. To keep the result of log output in a file, redirect the command output to a file.
    The following are the specification examples for keeping the results of log output in a file:
    In Windows
    > cjjspc -root D: \app\webapp1 1> .\stdout.log 2> .\stderr.log
    In UNIX
    # cjjspc -root /app/webapp1 1> ./stdout.log 2> ./stderr.log

(3) JSP pre-compilation when a J2EE application is started by the cjstartapp command

The cjstartapp command is used to start a J2EE application. In the cjstartapp command, if you specify the option that performs the JSP pre-compilation, the J2EE application is started after the JSP pre-compilation is implemented. The JSP pre-compilation functionality at the time of starting the J2EE application compiles all the JSP files contained in the J2EE application.

You can specify the settings for operation during execution of the cjstartapp command in advance. The following contents can be specified:

Note that you customize the operation settings of the J2EE server to implement these settings. For details on the customization of the operation settings of the J2EE server, see 2.5.8 Execution environment settings (J2EE server settings).

Reference note
When performing the JSP pre-compilation by the cjstartapp command, if an error occurs during translation of the JSP files or tag files, an error message is output to the Web servlet log or the message log.
Note
Compilation of Java source generated from JSP
The class file generated using with the cjjspc command is used at runtime on the J2EE server. In the cjjspc command, a class file same as that of the file generated on the J2EE server will be generated.
Therefore, when compiling Java source that is generated from the JSP file or tag file, you can only specify the version of the Java language specification in the -source option or the class path in the classpath option. For details on how to specify the versions of the Java language specifications, see cjjspc (JSP pre-compilation) in the uCosminexus Application Server Command Reference Guide.