Deploy And Undeploy Java EE Web Applications In Tomcat

Deploy or undeploy java web applications in tomcat is very easy to handle. You can either deploy or undeploy your war file manually or use tomcat manager. This article will show you how to do that.

1. Manually Deploy or Undeploy.

1.1 Manually Deploy

To manually deploy a war file is so easy, you just need to copy that war file to your tomcat webapps folder as below picture. After that, the war file will be extracted to a sub folder under webapps.

manually deploy java EE web application

Then you can access your web application by browse following url.
If you see below page that means your application has been deployed successfully.
browse sample web application

If you encounter any error, you can check the content in the unzipped folder. The content in it should like below.
the content file in sample web application folder

The web.xml content should be:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xsi:schemaLocation="" version="3.1">  
<!-- This is the java EE web application display name. -->
  <!-- This is the welcome file list. They are the files to be shown when you 
       do not add file name after java EE web application name.
       For example if you browse following url.
       Then Tomcat server will find below page first.
       If not found then find
       If not found then find
       Until it find one, then show that page content to client.
       If no file found, then return a 404 http status code to client.

You can see the comments in above web.xml to have an indepth understanding of welcome file list. If there is not any welcome file that can be found, you will see below web page when you browse the Java EE web application.

no welcome file exist in java EE web application folder

The index.html content should be:

<title>This is the demo Java EE web application for</title>
You are welcome to the demo Java EE web application for

1.2 Manually UnDeploy

It is very easy to UnDeploy it manually. You just need to delete the .war file under webapps. After a short moment the unzipped folder will also be deleted automatically.

2. Use Tomcat Manager to deploy or undeploy

2.1. Add A Manager Account

Input below url into a favorite browser, click enter.

If this is the first time you browse this url, a popup dialog will let you input the user name and password.
input username and password in popup dialog when browser tomcat manager

Please open below configuration file to add a new user account that can access Tomcat manager gui.

C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\tomcat-users.xml

Add below user in above file. Choose any username and password that you like and roles must be manager-gui.

<user username="admin" password="666666" roles="manager-gui"/>

add tomcat gui manager account

2.2 Deploy Java Web Applications

Now please browse http://localhost:8080/manager/ again and input the username and password you just added. After login you will see below application list page.
tomcat manager java EE web application list page

Now scroll the page down and go to the deploy section. Click the “Browse…” button to select the .war file that you want to deploy. After that click “Deploy” button.browse and deploy the web application in tomcat manager

Then you can find the application in the Applications list section. Browse http://localhost:8080/Dev2qaWebAppExample/ to confirm that it has been deployed successfully.

2.3 Undeploy Java Web Applications

It is so easy to undeploy applications with Tomcat manager gui. Go to applications list section. Click the “Undeploy” button, then you can find it has been undeployed successfully.
undeploy java EE web application with Tomcat manager gui

The attachment is the java web application .war package.

[download id=”3212″]

0 0 vote
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x