How to Clear Tomcat Cache in 3 Steps
There are several methods to clean the Tomcat cache:
- Restarting the Tomcat server is the simplest way to clear all caches and reload applications.
- Empty the Tomcat temporary folder: During operation, Tomcat generates some temporary files that can be manually cleared to clean up the cache. The Tomcat temporary folder is usually located in the ${TOMCAT_HOME}/work directory.
- Clearing the cache of an application: Some applications may cache data in Tomcat, and this cache can be cleared through the application’s management interface or console.
- You can clean the cache using Tomcat’s management interface: Tomcat provides a management interface that allows you to clean the cache. Simply visit http://localhost:8080/manager/html to open the management interface, then choose either Expire Sessions or Flush under Manager App to clean the cache.
- Using JMX to clean up cache: Tomcat supports the use of JMX to manage and monitor applications, allowing for the cleaning up of Tomcat’s cache. Tools such as JConsole or VisualVM can be used to connect to Tomcat’s JMX service and perform the necessary operations to clean up the cache.