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
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.
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
.
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/
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
.
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.
A little late for the party, here's how I do it
./shutdown.sh
/work/Catalina/...
./startup.sh
/webapps
and start it.