Saturday, 15 March 2014

Tomcat - war file deployment [Manager Application]

Enjoying this guide? Join our developer community!

Subscribe to Ram N Java on YouTube

How to Deploy a WAR File in Apache Tomcat (Using Manager App)

Deploying a web application on Apache Tomcat is straightforward once configured properly. In this tutorial, we focus on deploying your WAR (Web Application Archive) file directly using the graphical Tomcat Web Application Manager interface.

Step 1: Configure Users in tomcat-users.xml

By default, access to the Tomcat Web Application Manager is restricted for security. You must define a user and grant appropriate roles:

  1. Navigate to your Tomcat installation directory: tomcat/conf/.
  2. Open the tomcat-users.xml file using any text editor.
  3. Add the required roles and admin user credentials before the closing </tomcat-users> tag:
<role rolename="admin"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="admin" password="admin" roles="admin,manager-gui,manager-script"/>

Step 2: Restart Tomcat Server

For these user configuration changes to take effect, shut down your Tomcat server and start it again using the scripts inside your tomcat/bin/ directory (shutdown.bat / startup.bat on Windows or shutdown.sh / startup.sh on Linux/Mac).

Step 3: Access the Tomcat Manager Dashboard

  1. Open your web browser and go to: http://localhost:8080.
  2. Click on the Manager App button.
  3. When prompted, enter your configured credentials (e.g., username: admin, password: admin).

Step 4: Upload and Deploy Your WAR File

  1. Scroll down to the section titled WAR file to deploy.
  2. Click Choose File (or Browse) and select your WAR file from your local system.
  3. Click the Deploy button.

Once uploaded, Tomcat will automatically unpack the WAR and start your application. It will be listed under the running applications table with its context path.

Step 5: Managing Your Web Application

From the Manager console table, you can control the lifecycle of your web app using the action commands:

  • Start / Stop: Temporarily start or stop serving user requests without server restart.
  • Reload: Reload your application context if configuration files have changed.
  • Undeploy: Remove the application completely from the server with a single click.

Click here to watch in Youtube : https://www.youtube.com/watch?v=9X9DA8oVodk

To Download the Sample war file Click the below link:

https://sites.google.com/site/javaee4321/servlets/DisplayAllHeaders.war?attredirects=0&d=1

tomcat-users.xml

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin"/>
<user username="admin" password="admin" roles="admin,manager-gui,manager-script"/>

</tomcat-users>


Click the below Image to Enlarge
Tomcat - war file deployment 
Tomcat - war file deployment 
Tomcat - war file deployment 
Tomcat - war file deployment 
Tomcat - war file deployment 
Tomcat - war file deployment 
Tomcat - war file deployment 
Tomcat - war file deployment 
Tomcat - war file deployment 
Tomcat - war file deployment 
Tomcat - war file deployment 










































































































































See also:

  • Servlets Tutorial
  • All Design Patterns Links
  • 3 comments:

    1. Can you provide me the source code?

      ReplyDelete
      Replies
      1. Sanket, check in jdbc folder by name display all headers, there you will find the war kept by sir.

        Delete
      2. Sanket, Search in servlet folder you will find the war file kept by Sir

        Delete

    Tutorials