Wednesday, October 20, 2010

How to clear cache

What is actually WebLogic Cache?

Basically all the web-tier related files (.jsp .class, JSPCompiled files etc.,) get stored in some directory. This is treated as cache whenever there is 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 persistance, your web-tier may contain static contents then Cache will be used by WebLogic Application Server instance.



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 conflict with new code objects. This is where the need of removal of cache arises.
Where there is a need of new version deployment we might need to clear the cache when the changes to the new version is not reflected.



WLS 8


Delete below directories


Where 


BEA_HOME=/u001/wls8/bea
WL_HOME=/u001/wls8/bea/user_projects/prodDomain
1841server1 & 1841server2 are managed servers


# Delete WLS cache directories with ".internal" in name
# occasionally check for new directories with "find /u001/wls8/bea -name .internal"


rm -rf /u001/wls8/bea/user_projects/prodDomain/1841server1/.internal
rm -rf /u001/wls8/bea/user_projects/prodDomain/1841server2/.internal


# Delete WLS cache directories with ".wlnotdelete" in name
# occasionally check for new directories with "find /u001/wls8/bea -name .wlnotdelete"
rm -rf /u001/wls8/bea/user_projects/prodDomain/1841server1/.wlnotdelete
rm -rf /u001/wls8/bea/user_projects/prodDomain/1841server2/.wlnotdelete


# Delete WLS cache directories with "stage" in name
# occasionally check for new directories with "find /u001/wls8/bea -name stage"
rm -rf /u001/wls8/bea/user_projects/prodDomain/apps/1841server1/stage
rm -rf /u001/wls8/bea/user_projects/prodDomain/apps/1841server2/stage


WLS 9.x, 10.x


In 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: rd C:\bea\user_projects\domains\yourdomain\servers\yourserver\tmp\
UNIX: rm -rf /bea/user_projects/domains/yourdomain/servers/yourserver/tmp


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







8 comments:

  1. Hi....would there be any adverse effects if I follow these steps on Weblogic Server for my production env at Client location?
    Thanks..

    ReplyDelete
  2. You can do it on any environment.

    ReplyDelete
  3. I'll right away snatch your rss as I can not to find your email subscription link or e-newsletter service. Do you have any? Please permit me know in order that I may subscribe. Thanks.
    Look at my homepage ... he has a good point

    ReplyDelete
    Replies
    1. email subscription link is on right side below followers list :)

      Delete
  4. It's really helpful for me thanks alot.

    ReplyDelete
  5. For permanent solution ! deploy your application as no-stage mode | in next deployment it will clear cache automatically :)

    ReplyDelete
  6. Thanks....its really helpful...

    Regards,
    Tarun Dhir

    ReplyDelete