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, and deploy it, tomcat doesn't serve the newly published code (even after starting the service again).
I stop the service, then push the new war file to /webapps/, and I make sure to delete the old exploded folder also.
When I re-start the server, it still serves the older codebase.
Is there a setting in the config to stop this behaviour?
Also, what folders would I have to delete? Please be specific (folders and paths) as I have tried deleting some and havent' gotten anywhere.
Java web applications are usually packaged as WAR files for deployment. These files can be created on the command line or with an IDE, like Eclipse. After deploying the WAR file, Tomcat unpacks it and stores all the project files from the webapps directory in a new directory named after the project.
The work directory, as its name suggests, is where Tomcat writes any files that it needs during run time, such as the generated servlet code for JSPs, the class files for the same after they are compiled, the serialized sessions during restarts or shutdowns (SESSIONS.
You can delete the "work" directory.
Are you sure it's not a browser caching issue?
I'd add that in case of really odd behavior - where you spend a couple of hours saying WTF - try manually deleting the /webapps/yourwebapp/WEB-INF/classes
directory. A java source file that was moved to another package will not have its compiled class file deleted - at least in the case of an exploded web-application on TC. This can seriously drive you crazy with unpredictable behavior, especially with an annotated servlet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With