JSP Precompilation in WebLogic Application Server

JSP Precompilation in WebLogic Application Server:

Performance is paramount for any production system. A few seconds saved at the bottle neck is few seconds gained in the over all performance of the system. Compilation of JSP at runtime in a production environment can infuse an overhead. Hence it is a best practice to pre compile those JSP in such scenarios.

Precompilation offers below advantages:

  1. Enhances the performance by ensuring pre compilation of all the JSPs before deployment of the application.
  2. The Syntax errors in the sciptlet codes and custom tag elements could be detected at the compile time itself rather when the end user is accessing the application.

In WebLogic Server this can be achieved by weblogic.appc tool.

Weblogic.appc:

It’s an utility that generates and compiles the classes needed to deploy EJBs and JSP to WebLogic Application Server. It provides other features like deployment descriptor validations for standards compliance at both individual module level and the application level.

Syntax:

java weblogic.appc [options] <ear, jar, or war file or directory>

 

Using weblogic.appc as ant task:

You can incorporate appc in build.xml using an ant task wlappc..

For Ex:

 <taskdef name="wlappc" classname="weblogic.ant.taskdefs.j2ee.Appc" classpathref="dev.classpath"/>

<target name="jspc-webapps">

<!-- Pre-compile webapp JSP pages to src/web/WEB-INF/classes -->

<wlappc source="${srcweb}" classpathref="dev.classpath" verbose="true">

</wlappc>

</target>

This would ensure that the appc would scan through the web application at the source location and precompile the JSPs.

Further references:

http://docs.oracle.com/cd/E11035_01/wls100/ejb/appc_ejbc.html

 

Happy Readings.  🙂

Wonders Team

Leave a Reply