Disable JSP run-time compilation
By default, the JSP engine translates a requested JSP file, compiles the .java file, and loads the compiled servlet into the run-time environment. In previous releases of WAS, if a .class file did not exist, the JSP engine always translated and compiled the JSP file. You had to turn off the web application (.war)s reload capability to prevent additional translations and recompiles of the file.
With V5.1 of WAS, you can now change the JSP engine default behavior by indicating a JSP file should never be translated or compiled at run time, even when a .class file does not exist.
If run-time compilation is disabled, precompile the JSP files, which provides the following advantages...
- Reduces compilation related disk operations.
- Minimizes disk storage requirements necessary for handling temporary .java and .class files generated during a run-time compilation.
- Forces you to verify that a JSP file compiled successfully before deploying and installing the application in WAS.
You can disable run-time JSP file compilation on a global or an individual web application (.war) basis...
To disable the translation and compilation of JSP files for all Web applications, set the Web container Custom property disableJspRuntimeCompilation to true.
Set this property through the Web container Custom properties panel in the administrative console. To view this administrative console page, click
Servers > Application Servers > server > Web Container > Custom Properties > property_nameValid values for this setting are true or false. If this property is set to true, then translation and compilation of the JSP files is disabled at run time for all web application (.war)s.
To disable the translation and compilation of JSP files for a specific web application (.war), set the JSP engine initialization parameter disableJspRuntimeCompilation to true. This setting, if enabled, determines the run-time behavior of the JSP engine and overrides the Web container custom property setting.
Set this parameter through the JSP attribute assembly settings panel in the Assembling applications with the Assembly Toolkit.
Web Modules > component_instance > Assembly Property ExtensionsValid values for this setting are true or false. If this parameter is set to true, then, for that specific web application (.war), translation and compilation of the JSP files is disabled at run time, and the JSP engine only loads precompiled files.
If neither the Web container custom property nor the JSP attribute assembly parameter is set, the first request for a JSP file results in the translation and compilation of the JSP file when the .class file does not exist. Subsequent requests for the file also result in compilations and translations, but only if the following conditions are met:
- Compilations and translations are required.
- Reloading is enabled for the Web module.
- Reload interval is exceeded.
If you disable run-time compilation and a request arrives for a JSP file that does not have a matching .class file, the JSP engine returns HTTP error 501 (Not implemented) to the browser. If the JSP file does not exist, the JSP engine returns HTTP error 404 (File not found) to the browser. In both cases, an exception is written to the System Out (SYSOUT) and First Failure Data Capture (FFDC) logs. If a JSP file has a matching .class file but that file is out of date, the JSP engine still loads the .class file into memory.
Perform the following steps to determine whether the disableJspRuntimeCompilation option is enabled in WAS...
- Enable the Diagnostic Trace Service and set the trace specification to com.ibm.ws.webcontainer.jsp.servlet.*=all=enabled.
- Request a JSP file.
- Locate the string, disableJspRuntimeCompilation:true, in the trace.log file.
- Ensure the jspUri: entry matches the requested JSP file.
If both the disableJspRuntimeCompilation:true string and the matching jspUri: entry appear in the trace, the disableJspRuntimeCompilation setting is enabled for the web application (.war).
See Also
JSP files
Developing Webapplications
Custom property settings