Precompile JSP files

If you've added the JSP performance enhancements I've discussed in an earlier post. Then I talked about a flag that disabled JSP compilation.

In order to run without compilation enabled you need to precompile your JSP files.

This could be done with the JspBatchCompiler command found in {WAS_ROOT}/bin

This command has multiple parameters but only a few makes sense for Commerce.

  • - The name of your ear application usually WC_{instanceName}
  • - You want to give this parameter Stores.war if you have disabled JSP compilation in your store.
  • compileToWebInf - set this value to false. If you don't the server has to look for your JSP files in the WEB-INF directory instead for the temp directory where the classes usually are compiled.
  • - Usually WC_{instanceName}_cell in a single node environment.
  • - Usually WC_{instanceName}_node in a single node environment.
  • - Usually server1 in a single node environment.
  • useCDataTrim - set this value to true. This will decrease the size of the delivered code to browsers removing extra line breaks in the compiled classes.
  • forceCompilation - set this value to true if you want all the JSP pages every time. You could set this to false but then you should set the  trackDependencies to true so you don't miss any changes.
  • jdkSourceLevel - I needed this to be 15 to insure that all our customizations where working properly. Might not be needed in your implementation.

An example command string

JspBatchCompiler.bat WC_demo Stores.war -compileToWebInf false WC_demo_cell WC_demo_node server1 -useCDataTrim true -forceCompilation true -jdkSourceLevel 15

A parameter I found after trying that you shouldn't use in a Commerce environment is the useFullPackageNames. This will compile the class files into a separate directory _ibmjsp where the application server will not find your files.After you've compiled your files the application needs a restart to find the newly compiled classes.


Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.