THE WORLD DISCUSSES #PYTHIAN ON TWITTER. HAVE A QUESTION? USE OUR HASHTAG AND ASK AWAY.

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 justrunto 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.

4 Responses

  1. John Piwowar says:

    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.

  2. Vinod says:

    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

  3. Prasanna Thiagarajan says:

    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

  4. Prasanna Thiagarajan says:

    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)

Leave a Reply

Start NowWith Pythian - database design, management and emergency handling capabilities...

Live Updates

pythian: RT @sheeri: #confoo talk "Bending Queries to your Will with EXPLAIN" slides http://bit.ly/explainslides & handout
more



Testimonials

  • Serge Racine

    DBA, Brookfield Energy

    We are very satisfied by the service given to us by Andre and Shakir in support of our recent data quality and reorganization initiative.... more