JSP Cache Issues in 11i and R12

As an Apps DBA, you might have been asked to clear the JSP cache many times, either by Developers or Oracle Support. The usual directory that holds the JSP cache is $COMMON_TOP/_pages
in 11i and R12 releases. In older versions of 11i it used to be $OA_HTML/_pages
.
What is this JSP Cache? It’s the compiled version of JSP files. When JSP gets compiled by Apache Jserv, it gets internally gets converted into a .java file (servlet) and then that .java file gets compiled into a .class file
Why do we need to clear the JSP cache?
To optimize JSP runtime performance. Even if after you update a JSP file in $OA_HTML
directory, Jserv will only look for .class files in the _pages
directory. If it doesn’t find the .class file, then it attempts to compile the .jsp into a .class file and then run it. In R12, this behavior changed a bit, as JSP are being handled by OC4J instead of Jserv. In R12, if OC4J doesn’t find the .class file in the _pages
directory, it will just render a blank page and will not even attempt to compile the JSP.
The good news is that there is a script to manually compile JSPs. The script name is ojspCompile.pl
, located in $JTF_TOP/admin/scripts
in 11i, and $FND_TOP/patch/115/bin
in R12. We can use this perl script to compile the JSPs. Note that we must bounce the Apache service in 11i, and the oacore service in R12 for changes to take effect. This is because, if the .class file is already loaded into the JVM’s memory, it will not even look under the _pages
directory for updated files. This is another optimization in Jserv and OC4J for better JSP performance.
In a Development Instance with active customizations going on, it’s a pain for the DBA to clear the JSP cache or compile JSPs manually. If you are facing this problem, don’t worry, here is a fix for this issue.
In 11i, change developer_mode
to true in the zone.properties
file in the line below:
servlet.oracle.jsp.JspServlet.initArgs=translate_params=true, developer_mode=false,page_repository_root=/apps/prodcomn/_pages
In R12, change justrun
to recompile
in the orion-web.xml
file under the $ORA_CONFIG_HOME/10.1.3/j2ee/oacore/application-deployments/oacore/html
directory:
<init-param> <param-name>main_mode</param-name> <param-value>justrun</param-value> </init-param>
These parameter changes will make Jserv and OC4J look for updated JSP and class files whenever they try to get executed. These parameters are not recommended in Production, as checking file timestamps adds additional overhead to page load times, but it is definitely worth setting in a Development environment.
Another point is, in R12, orion-web.xml
changes can be made permanent by updating the s_jsp_main_mode
tag from justrun
to recompile
in the context xml file.
I’d love to hear your experiences with the JSP cache, as well and how this post might have helped you.