Monday, July 12, 2010

Clearing Cache for WebLogic instance

Hey smart WLA, 

Here I am with one more interesting story of WebLogic Administration "Clearing Cache". This is most often in development environments, where you need to clear the cache for new releases for Web-tier changes, XML loadings, JDBC connection changes, JMS issues, etc.,.

Some of the great developers think like this "I can change minor things directly in the jsp files to test stuff"

What is actually WebLogic Cache?

Basically all the web-tier related files (.jsp .class, JSPCompiled files etc.,) get stored in ./wlnotdelete/app_yourapplicaiton directory. This is treated as cache whenever there is a restart of a WebLogic instance happen then the WebLogic server will look up for last serviced object status stored in the cache to service for any pending requests. Usually, when your EJB Classes need sessions, JMS object requires persistence, your web-tier may contain static contents then Cache will be used by WebLogic Application Server instance.

WebLogic Clear Cache
Cache Clearing in WebLogic Domain



Why we need to remove Cache?

Whenever your application is accessed for the first time that fresh deployment of a new version, WebLogic server lookup in this directory, if there are older objects persists that will be a conflict with new code objects. This is where the need of removal of cache arises.

Where there is a need of a new version deployment we might need to clear the cache when the changes to the new version is not reflected. In the old version WebLogic 8.1 below we used to remove the .wldonotdelete folder. In the new version of WebLogic 9.x onwards removal of cache means deleting each server instance's tmp folder contains cache, stage folders or you can simply remove tmp folder too provided there should not be configuration changes happen to the server.

Generally for WebLogic 9.x and higher versions
WIN: C:\bea\user_projects\domains\yourdomain\servers\yourserver\tmp
UNIX: /bea/user_projects/domains/yourdomain/servers/yourserver/tmp

you can use the following commands to clear the cache:
WIN: rmdir C:\bea\user_projects\domains\yourdomain\servers\yourserver\tmp \s
UNIX: rm -rf /bea/user_projects/domains/yourdomain/servers\yourserver/tmp

Here I am removing all the subdirectories and files in the given directory.

When to do this Clearing Cache?

After Stopping the WebLogic server instance you can go for removal of cache.
Mostly, Spring framework users, struts framework users have this no changes reflected issue for their web applications.

An alternative solution is you can use the 'stage' mode set to 'no_stage' deployment. when undeployed an application then WebLogic server itself removes the cache objects.

16 comments:

  1. How do you clear the nodemanager cache? im runnign weblogic on windows and my nodemanager has stored a previous system PATH and it had spaces now i have fixed it in the windows envionment variables but when i try start the managed server from the admin console using nodemenager but it errors out and show evidence of the previous path being stored somewherhe.

    i have uninstalled the service and reinstalled and reboot the server but nothing seems to work.

    ReplyDelete
  2. Its Really helpful,

    about hte weblogic cache.

    Thanks

    ReplyDelete
  3. thank you so much, it's very usefull to know how to clean apps cache.

    ReplyDelete
  4. Hi,
    I have a issue ,when custom log files relted to application is getting cached , even its doing the changes in the physical/box directory its not doing the changes when I am trying to access through the web URL , it has permissions , I need to know if hts caches how can I get the new logs to show up.

    Thanks
    Vivek

    ReplyDelete
  5. @Vivek, correct me if I missing anything you mentioned, If your logs are accessible through web URL you might sort them to show up new one on top. sort works different for different OS environments. check which program pulling the logs to your web URL update with sort functionality.
    hope you it will works!

    ReplyDelete
  6. Hi,

    Since we migrated from91 to 10.3.5, I am seeing that I must physically remove the precompiled jsp pages from the work directory. This happens 90% of time that WebLogic is
    not recognizing the updated page and recompiling it. Any idea why this is happening.
    Its a exploded ear and war way of deployment.In weblogic 91 copying the jsp pages to war doesn't require the pysical deleteions of jsps. Any ideas would be higly appreciated.

    Thanks
    DK

    ReplyDelete
    Replies
    1. We also are facing the same types of issues, specifically with out JSP pages....Came across an article noting the jsp descriptor "page-check-seconds". It states that in 10.x it defaults to -1 in production mode, and hence never checks to see if there is a newer version of a jsp. You can set this to 0 to always check, or another value to check in "n" seconds (ie 60). We are going to try this and see if it helps, but was wondering if anyone else has tried with any success?

      Delete
  7. we have installed Weblogic server 10.3.6 in RHEL 5.8.There also a "tmp" folder inside <> folder..this is the path of tmp folder in my case..Now My queary :: Is it Mandatory to delete files from tmp folder manally or the The Server will take care of this action..please let me know..If we have no action taken for tmp deletion is there any Impact on Application server. ?? Actullay is there any way to delete tmp i.e After downing the App server ? is there any priority in that.Please let me know and reply to mail "nlkalyan.434@gmail.com"

    ReplyDelete
  8. Hello Sir, i have WLS 11g running under RHEL 5x.. The log files are appending Properly upto now.. Now i found " ManagedServer1.out " file is missing .. which is Importamnt log file ,gives info after Restarting of WLS server.It is to be found that remaining log files are presemnt as usual. Except ManagedServer1.out. This is present in "" /root/Oracle/Middleware/userprojects/domains/base_domin/servers/ManagedServer1/logs/ "" directory .. Tell me Which one is Missing and the Chance of missing the Log file...

    ReplyDelete
  9. Hi Kalyan, You could check two things in your weblogic environment 1. Domain bin does any wrapper start scripts are there which gives the path to store the .out file in different location. 2. In the Admin Console Standard out redirection to .log file? These are the possibilities check and let us know...

    ReplyDelete
  10. Hi Sir,
    i have checked the this ./setDomainEnv.sh file in /root/Oracle/Middleware/user_projects/domains/chl_domain/bin directory and not found path to store .out file

    step -2: also checked ./commEnv.sh file in /root/Oracle/Middleware/wlserver_10.3/common/bin/ Directory.. Not found ..
    step -3 :: as per Admin console::
    Logging :::::
    in Standard out ::::
    .....................................
    Severity level : Notice
    filter : none
    Domain log broadcaster :::::::
    ...........................................................
    Severity level : Notice
    filter : none


    ReplyDelete
    Replies
    1. did you checked 1 =STDOUT 2= STDERR value in any of the startWebLogic.sh or startManagedWebLogic.sh scripts?? What is the script that you use for starting the managed server?? share that let us see.

      Delete
    2. for admin server :: Domain -under bin direcroty ./stratWeblogic.sh
      fort managed server :: ./startManagedServer.sh

      Nothing have beed changed in the startWeblogic.sh and not found STDOUT & STDERR

      Delete
  11. pls check my standardout configs and let me know ,.any thin have to change !!

    ReplyDelete
  12. Hey , i have a question about JCO in SAPAdapter, when I change the XSD of an IDOC in SAP and I deploy my OSB project the JCO is not reinstalled ! It use the previous version of IDOC. how can I clear the JCO cache without a restart ?

    ReplyDelete
  13. is there any using wlst script to clear temp data cache folders?

    ReplyDelete

Blurb about this blog

Blurb about this blog

Essential Middleware Administration takes in-depth look at the fundamental relationship between Middleware and Operating Environment such as Solaris or Linux, HP-UX. Scope of this blog is associated with beginner or an experienced Middleware Team members, Middleware developer, Middleware Architects, you will be able to apply any of these automation scripts which are takeaways, because they are generalized it is like ready to use. Most of the experimented scripts are implemented in production environments.
You have any ideas for Contributing to a Middleware Admin? mail to me wlatechtrainer@gmail.com
QK7QN6U9ZST6