How to purge tomcat's cache when deploying a new .war file? Is there a config setting?

前端 未结 10 981
忘掉有多难
忘掉有多难 2020-12-09 14:43

I have a simple hello, world servlet application that I am just playing around with, and pushing it out to my tomcat server on a VPS.

When I make a change to my code

相关标签:
10条回答
  • 2020-12-09 15:14

    I'm new to tomcat, and this problem was driving me nuts today. It was sporadic. I asked a colleague to help, and the WAR expanded and it did was it was supposed to. 3 deploys later that day, it reverted back to the original version.

    In my case, the MySite.WAR got expanded to both ROOT AND MySite. MySite was usually served up. But sometimes tomcat decided it liked the ROOT one better and all my changes disappeared.

    The "solution" is to delete the ROOT website with every deploy of the war.

    0 讨论(0)
  • 2020-12-09 15:19

    Tomcat also creates a ROOT directory at the same level as work/. ROOT/ also caches the old stuff. delete ROOT along with Catalina directory in work.

    0 讨论(0)
  • 2020-12-09 15:22

    I encountered some weird behaviour that did not reflect the actual code base so after some time trying several solutions, my problem was solved by manually deleting everything under /var/cache/tomcat8/

    0 讨论(0)
  • 2020-12-09 15:24

    I have a bad time putting my war file at /etc/tomcat7/webapps but the real path was /var/lib/tomcat7/webapps. May you want to use sudo find / -type f -name "my-war-file.war" to know where is it.

    And remove this folders /tmp/hsperfdata_* and /tmp/tomcat7-tomcat7-tmp.

    0 讨论(0)
  • 2020-12-09 15:26

    Seems a timestamp issue. According to tomcat documentation, if there is a new jsp or servlet this will create a new _java file in the work folder unless the _java.class files are newer than the jsp or servlets.

    0 讨论(0)
  • 2020-12-09 15:33

    A little late for the party, here's how I do it

    1. Undeploy application from manager
    2. Shutdown tomcat using ./shutdown.sh
    3. Delete browser cache
    4. Delete the application from webapps, and from /work/Catalina/...
    5. Startup tomcat using ./startup.sh
    6. Copy the new version of the application into /webapps and start it.
    0 讨论(0)
提交回复
热议问题