In this tutorial I will show you how to deploy and undeploy Java EE web applications in Apache Tomcat using 2 different methods.
Manually Deploy and Undeploy Applications in Tomcat
Deploying an application manually in Tomcat is simple – just put your .war
file in Tomcat’s webapp
directory. If your Tomcat is running it will unpack the .war
file into a folder with the same name without the war extension. If it is not running the deployment will happen a few moments after you start the server.
It is always a good practice to check the server log for errors while deployment. It may happen, that your application is missing some dependencies, or the file .war
file you builded has not the right structure – in this case your deploy will not succeed.
Undeploying the application is as simple as reversing the process. Just delete your .war
file from the webapp
directory and in a few moments Tomcat will erase all the unpacked files for you.
Deploy and Undeploy Applications with Tomcat Manager
You can use the graphical manager interface to deploy or undeploy application. If you didn’t enable the manager you can learn more on how to do this in our previous tutorial about Tomcat configuration.
1. Open your browser and go to http://localhost:8080/manager/html
2. Enter your username and password specified in conf/tomcat-users.xml
file
3. Click the “Choose File” button in “WAR file to deploy” section. Browse your .war
file and click the “Deploy” button
4. To undeploy an application click the “Undeploy” button next to it
View Comments (3)
I pressed undeploy for the path /., welcome to tomcat application by accident. Is there any way to deploy that without out re-installing?
You may use the original Tomcat archive to extract the content of /. folder and paste it into your current Tomcat deployment folder
Thanks