+

Search Tips   |   Advanced Search

JSP class file generation

At runtime, the WAS JSP (JSP) engine loads JSP class files from either the WAS temp directory or a web module's WEB-INF/classes directory. The JSP engine first searches for a class file in the temp directory and then it searches in the web module's WEB-INF/classes directory.

In a default installation, the WAS temp directory is typically profile_root/temp. Figure 1 shows the processing logic of the JSP engine at runtime.

You should not use the CANCEL appserver_proc_name command to stop a server. Every time a server is cleanly stopped, these temp directories are removed. However, if the server is frequently not stopped cleanly, which happens if we cancel rather than stop the server, these directories are not removed and the HFS used for the temp directory eventually becomes full. We can also prevent this storage problem from occurring if you precompile the JSP files when you install an application or if you use the JspBatchCompiler function to precompile them before they are invoked.

When JSPs are compiled at runtime, the same generated classes are placed in each servant temporary directory. Those classes are then deleted when the server or servant is recycled, which is inefficient and leads to increased disk space usage to hold each copy of the same compiled classes. If the servant or server fail for any reason, these compiled classes are not be cleaned up automatically. Also, the deleted JSP classes have to be recompiled after each servant restarts.

The above inefficiency has been corrected. When JSPs are compiled at runtime, the JSP container generates the compiled classes into a common server temporary directory which persists after the server or servant has restarted.

The batch compiler supports the generation of class files in both the WAS temp directory and a web module's WEB-INF/classes directory, depending on the type of batch compiler target. In addition, the batch compiler enables the generation of class files into any directory on the filesystem, outside of the target application. Generating class files into a web module's WEB-INF/classes directory enables you to deploy the web module as a self-contained WAR file, or a WAR file inside an EAR file. The following table shows the batch compiler's behavior when compiling class files.

ear.path or war.path supplied enterpriseApp.name supplied
compileToDir not supplied; compileToWebInf not supplied, or is true The class files are compiled into the web module's WEB-INF/classes directory. The class files are compiled into the web module's WEB-INF/classes directory.
compileToDir not supplied; compileToWebInf is false The class files are compiled into the web module's WEB-INF/classes directory.

The class files are compiled into the WAS temp directory, usually profile_root/temp.

compileToDir is supplied; compileToWebInf not supplied, or is either true or false The class files are compiled into the directory indicated by compileToDir. The class files are compiled into the directory indicated by compileToDir.


Related concepts

  • Packages and directories for generated .java and .class files

  • JSP batch compilation

  • Global tag libraries (deprecated)


    Related tasks

  • Configure JSP engine parameters

  • Web container configuration for JSP static file access
  • JSP (JSP) runtime reloading settings Concept topic