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.
16 Comments. Leave new
Hi Vasu,
Great post, and a nice tip on adding the ‘recompile’ mode to the context file; I didn’t know about that. :-)
I’ve also found the -s argument to ojspCompile.pl to be useful. There have been situations where I knew I only needed to recompile one or two JSPs. ojspCompile.pl –compile -s ‘MyFavoriteJSP.jsp’ gets the job done in a few seconds, rather than 15-20 minutes to recompile all JSPs.
Regards,
John P.
Hi Vasu,
Can you explain more about the jtf cache port and what is the expected status of this port (occupied/unocccupied) on each MT in a multi MT environment.
We often hit this error in my environment
____________
IAS Cache initialization failed. The Distributed Caching System failed to initialize on port: 10562. The list of hosts in the distributed caching system is: 140.85.99.163 . The port 10562 should be free on each host running the JVMs.
____________
When I check this port is sometimes occupied by OPP and other CM related processes. When I bring down CM and start the oacore, it comes up fine. But when I check the other MT, the jtf port might be occupied by some other process but still the oacore comes up fine.
So can you please detail what is expected out of this port and the other related information about it.
Thanks,
Vinod
Hi Vasu,
This is a great post.
I have a question regarding how jsp how its treated between 11i and R12.
We have a jsp which allowe us to open pdf files from file system, that works well in 11i instance.
R12 instance we are able to open the pdf file but the images in the pdf file are missing only text part is comming up.
can you please guide me how to debug this issue.
Thanks
-Prasanna
Here is application.log
10/03/10 16:26:01.694 html: chain failed
java.io.IOException: The Writer is closed
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.EvermindJSPWriter.print(EvermindJSPWriter.java:707)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.EvermindJSPWriter.write(EvermindJSPWriter.java:701)
Hi Vasu,
Very nice explanation.
Regards
Jyotirmay Pathak
Hi Vasu, its a goodpost and very useful.
Regards,
Sasi
Hi vasu,
Good article, very useful for jsp developers. I have scenario, where in am importing few oracle class residing under JAVA_TOP in a jsp file which is under $OA_HTML. When I compile this jsp file it will definitely through error as class files will not be accessible from OA_HTML. So am not compiling the jsp file in R12 instance, when I try to navigate to this jsp page in the instance servlet was getting auto created in _pages folder. somehow now its stopped creating the servlets and my changes in jsp files are not reflecting, infact am getting a blank page as it could not find the servlet. Any thoughts on this.
Hi,
I get hte below:
But there no class files under _pages.
sun1597_applmgr_ERP12SAN$ perl ojspCompile.pl –compile –flush -p 2
logfile set: /u003/oracle/ERP12SAN/inst/apps/ERP12SAN_sun1597/logs/appl/rgf/ojsp/ojspc_error.log
starting…(compiling all)
using 10i internal ojsp ver: 10
synchronizing dependency file:
enumerating jsps…0
initializing compilation:
eliminating children…0 (-0)
No compilations needed.
I changed orion-web.xml also to recompile.
I also deleted everything under
/u003/oracle/TEST/apps/apps_st/comn/webapps/oacore/html.
Is this causing issue?
Any way to bring up the application.
Do help me.
Thanks,
RJ
you should not delete files under common_top/webapps/oacore/html.
these are the source jsp files that are required for apps to function. the jsp cache files will be under common_top/_pages.
So please restore html directory from backup or copy them from another identical instance. and then regenerate cache using ojspCompile.pl
I am facing a typical issue
I have developed a JSP and paste in OA_HTML top and executed found was working fine.
After some modification the JSP was pasted in OA_HTML top, but the changes was not got impact.
Then I have recompile the mentioned way ojspCompile.pl –compile -s ‘MyFavoriteJSP.jsp’ but no use,
anyone can help me.
Thanks
Jeyaseelan
I too am facing similar issue….I changed jsp under OA_HTML but its not reflecting in the error log….old errors are visible each time the dba compiles.
I have removed the error lines and pasted new lines which are not being picked up during compilation.
Any solution for this issue?
Hello Vasu,
This post is nice and full of information indeed. I knew these setting about 11i but R12 setting are new for me. :-) Thanks for sharing the vital information.
Thanks
Anubhav Jain
Very good article. Thank you
Dear,
How make the changes permenant in orion-application.xml file, recently we made the changes once we run the autoconfig the changes are gone.please advice.
Thanks and Regards.
Hi Babu, you need to customize below template to preserve the changes
$FND_TOP/admin/template/orion_application_xml_1013.tmp
For the procedure to customize follow section “Customizing an AutoConfig template file delivered by Oracle” in Oracle note “Customizing an AutoConfig Environment (Doc ID 270519.1)”
Vasu,
We had an issue in one of the middle tier yesterday and the apache log was continueouly throwing the below error.
[19/02/2015 07:46:10:819] (ERROR) ajp12: Servlet Error: java.lang.NoClassDefFoundError: Could not initialize class oracle.apps.fnd.profiles.Profiles: Could
not initialize class oracle.apps.fnd.profiles.Profiles
We bounced the apache couple of times but no joy. Later I identified that one of the failed OPP manager process was holding the cache port. Users
could hit this port as soon as we cleared this process from the OS level.
However, even now I noted that one of the OPP process is still occupying that port. Could you please clarrify the following?
a) Why the OPP process is occupying the cache port?
b) Why sometimes it is causing the issue?