JSPBatchCompiler command


 

+

Search Tips   |   Advanced Search

 

The batch compiler validates the syntax of JSPs, translates the JSP pages into Java source files, and compiles the Java source files into Java Servlet class files. The batch compiler also validates tag files and generates their Java implementation classes. Use this function to batch compile the JSPs and thereby enable faster responses to the initial client requests for the JSPs on the production Web server.

The batch compiler can be executed against compressed or expanded EAR and WAR files, as well as enterprise apps and Web modules that have been deployed into WAS. When the target is a deployed enterprise application, the server does not need to be running to execute the batch compiler. If the batch compiler is executed while the target sever is running, the server is not aware of an updated class file and does not load that class file unless the enterprise application is restarted. When the target is a compressed EAR file or WAR file, the batch compiler must expand it before executing.

 

Processing of Web modules

The batch compiler operates on one Web module at a time. If the target is either an EAR file or an installed enterprise application that contains more than one Web module, the batch compiler operates on each Web module individually.

JSP pages are configured on a Web module basis using web.xml files. Within a Web module, the batch compiler processes one directory at a time.

The batch compiler validates and translates each JSP page individually, and then invokes the Java compiler for the entire group of generated Java sources files in that directory. If one JSP page fails during the Java compilation phase, the Java compiler might not create class files for most or all of the JSP pages that successfully compiled in that directory.

 

JSP file extensions

The batch compiler uses four things to determine what file extensions it should process:

  1. Standard JSP file extensions

    • *.jsp
    • *.jspx
    • *.jsw
    • *.jsv

  2. The url-pattern property of the jsp-property-group elements in the deployment descriptor file in Servlet 2.4 Web modules

  3. The jsp.file.extensions JSP engine configuration parameter (for pre-Servlet 2.4 Web modules)

  4. The batch compiler configuration parameter jsp.file.extensions

The standard extensions are always used by the batch compiler.

If the Web module contains a Servlet 2.4 deployment descriptor, the batch compiler also processes any url-patterns found within the jsp-config element.

If the batch compiler target contains the JSP engine parameter jsp.file.extensions, then those extensions are also processed.

If the batch compiler configuration parameter jsp.file.extensions is present, the extensions given are also processed and will override the JSP engine configuration parameter jsp.file.extensions.

Give JSP 'fragments' an extension not processed by the batch compiler. Statically-included fragments that do not stand alone generate translation or compilation errors if processed.

The JSP 2.0 Specification suggests that you use the extension .jspf for such files.

 

Batch compiler command

To execute, run...

WAS_ROOT/bin/JspBatchCompiler.sh|bat

An Ant task is also available for executing the batch compiler.

The batch compiler target is the only required parameter...

 JspBatchCompiler.sh -ear.path | -war.path | -enterpriseapp.name <name>
                [-response.file <filename>]
                [-webmodule.name <name>]
                [-filename <jsp name | directory name>
                [-recurse <true | false>]
                [-config.root <path>]
                [-cell.name <name>]
                [-node.name <name>]
                [-server.name <name>]
                [-profileName <name>]
                [-extractToDir <path>]
                [-compileToDir <path>]
                [-compileToWebInf <true | false>]
                [-compileToWebInf <true | false>]
                [-compileAfterFailure <true | false>]
                [-translate <true | false>]
                [-compile <true | false>]
                [-removeTempDir <true | false>]
                [-forceCompilation <true | false>]
                [-useFullPackageNames <true | false>]
                [-trackDependencies <true | false>]
                [-createDebugClassfiles <true | false>]
                [-keepgenerated <true | false>]
                [-keepGeneratedclassfiles <true | false>]
                [-usePageTagPool <true | false>]
                [-useThreadTagPool <true | false>]
                [-classloader.parentFirst <true | false>]
                [-classloader.singleWarClassloader <true | false>]
                [-additional.classpath <classpath to additional JAR files and classes>]
                [-verbose <true | false>]
                [-deprecation <true | false>]
                [-javaEncoding <encoding>
                [-jdkSourceLevel <13 | 14 | 15>]            
                [-compilerOptions <space-separated list of java compiler options>]
                [-useJikes <true | false>]
                [-jsp.file.extensions <file extensions to process>]
                [-log.level <SEVERE | WARNING | INFO | CONFIG | FINE | FINER | FINEST | OFF>]

For more info, review...

WAS_ROOT/bin/batchcompiler.properties.default
WAS_ROOT/bin/JspCBuild.xml

The batch compiler is aware of three groups of configuration parameters:

  1. JSP engine
  2. Batch compiler response file
  3. Batch compiler command line

Precedence...

  1. Command line
  2. Response file named on the command line
  3. JSP engine

If parameter not found, default is used (See below).

With one exception, these parameters are not case sensitive; -profileName is case sensitive.

If the values specified contain spaces, add quotation marks around the values.

The batch compiler does not values for equivalent JSP engine parameters. If a JSP page in a deployed Web module is modified and is recompiled by the JSP engine at run time, the JSP engine's configuration parameters will determine the engine's behavior. For example, if we compile a Web module with...

-useFullPackageNames

...true also go into the JSP engine and set...

useFullPackageNames

...to true to allow the JSP runtime the ability to load the compiled JSP pages. If JSP pages are modified in a deployed Web module, then the engine's parameters should be set to the same values used in batch compilation.

Usage:





Related concepts

JSPs

 

Related tasks

Set JSP engine parameters

 

Related

Batch compiler ant task
Web apps: Links