Enjoying this guide? Join our developer community!
Subscribe to Ram N Java on YouTubeHow 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:
- Navigate to your Tomcat installation directory:
tomcat/conf/. - Open the
tomcat-users.xmlfile using any text editor. - Add the required roles and admin user credentials before the closing
</tomcat-users>tag:
<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
- Open your web browser and go to:
http://localhost:8080. - Click on the Manager App button.
- When prompted, enter your configured credentials (e.g., username:
admin, password:admin).
Step 4: Upload and Deploy Your WAR File
- Scroll down to the section titled WAR file to deploy.
- Click Choose File (or Browse) and select your WAR file from your local system.
- 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.
Recommended Related Tutorials from Ram N Java
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 |
Can you provide me the source code?
ReplyDeleteSanket, check in jdbc folder by name display all headers, there you will find the war kept by sir.
DeleteSanket, Search in servlet folder you will find the war file kept by Sir
Delete