I have a Java servlet web app (.war) which I deployed to Tomcat Ubuntu server.
Can I change the content the Java classes at: myProject/WEB-INF/classes/
without re-export-and-deploy the entire app ?
Thanks in advance.
I could thought of below to re deploy your app without restarting tomcat:
java
file.class
filetouch
ing WEB-INF/web.xml
Disclaimer: I don't recommend doing this because it can give unexpected results. I am aware that sometimes you need to do "quick-and-dirty" fix, but consider yourself warned :)
I assume you have a Web application, let's call it 'MyApp'. Go to <TOMCAT-DIR>/webapps
and locate your MyApp.war
file. Put new .class file into the MyApp.war
(open it with some archiver) and then delete the folder <TOMCAT-DIR>/webapps/MyApp
. Deleting the folder means undeployment for Tomcat. After some time, Tomcat will figure out that it has a .war file in his <TOMCAT-DIR>/webapps
folder that needs to deploy and it will automatically do it. You will see in Tomcat's log something like:
Aug 25, 2015 9:24:55 AM org.apache.catalina.startup.HostConfig undeploy
INFO: Undeploying context [/MyApp]
Aug 25, 2015 9:24:55 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /home/tomcat/apache-tomcat-7.0.55/webapps/MyApp.war
Aug 25, 2015 9:25:17 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /home/tomcat/apache-tomcat-7.0.55/webapps/MyApp.war has finished in 21,937 ms
And there you go, you just refreshed your application without redeployment and without restarting server.
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