Redeploying web applications in Apache Tomcat using touch command
In this post I am going to tell you about a way to redeploy web applications in Apache Tomcat. This is a best practice in using Tomcat in deployment environment.
When testing the deployed web applications in Apache Tomcat, often we need to redeploy them. During the first couple of days I'm using Tomcat, when I want to redeploy a web application, what I always did was, shutting down the Tomcat server and then again starting it. But think for a moment, can we do this in deployment environment ? We can't. Because, when we shut down the Tomcat server just to redeploy a single web application , all the other applications inside that server go down. This is very risky in sometimes.
So, how can we redeploy a single web application inside Tomcat without affecting others ? There is a very simple way, and it's just a command only. It is the "touch command". Here is how to use it.
$ touch <path-to-web-app>/WEB-INF/web.xml
It's as simple as that. :)
What is web.xml file ?
It is called the web application's deployment descriptor. It contains the configuration details and other useful details of the web application.
The url mappings are contained in the web.xml file. When the web server receives a request
for the application, it uses the deployment descriptor to map the URL of
the request to the code that ought to handle the request.
You can read more on web.xml file from here.