简体   繁体   English

如何清理tomcat缓存?

[英]How to clean tomcat cache?

I use code like: 我使用如下代码:

  Thread currentThread=Thread.currentThread();
  ClassLoader classLoader=currentThread.getContextClassLoader();
  InputStream configFile=classLoader.getResourceAsStream("config.xml");

But this code starts to work after 2 - 3 hours. 但是此代码在2到3个小时后开始工作。 I didn't nothing - only restart, clean, deploy, etc. 我什么也没做-只是重新启动,清理,部署等。

I suppose that old jar/class that cannot find file config.xml was in some cache - may be in cache of tomcat or in cache of OS/VM. 我想找不到文件config.xml的旧jar /类位于某个缓存中-可能位于tomcat的缓存中或OS / VM的缓存中。 Does it possible? 有可能吗 Thanks. 谢谢。

Unfortunately i can't make comments i dont have 50 reputation yet so i will just write my comment into this answer, 不幸的是我无法发表评论,但我还没有50的声誉,所以我只想在这个答案中写下我的评论,

Can you explain more about the code? 您能否进一步解释该代码? What tool do you use to prepare the code? 您使用什么工具来编写代码? How do you deploy it ? 您如何部署它? My assumption is that if you "only" make a restart, clean and after a deploy it will not work, do it the other way, clean, deploy, restart. 我的假设是,如果您“仅”进行重新启动,清理,并且在部署后将无法正常工作,请以另一种方式进行清理,部署,重新启动。 If you give more information, i can give you a better answer. 如果您提供更多信息,我可以为您提供更好的答案。

What you can try to do is delete the application cache or set the caching off if you believe its a caching issue 您可以尝试做的是删除应用程序缓存或在您认为它存在缓存问题的情况下将其设置为缓存

cachingAllowed="false" in confg/context.xml confg / context.xml中的cachingAllowed =“ false”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM