How to Deploy a war on Tomcat
Points To Remember
  • You should have a war file that can be deployed to the tomcat.
  • You should have tomcat installed on your machine.
Deploying a war file on Tomcat.
We hope you have a installed the tomcat or have the tomcat bundle extracted on your system. In your case we just downloaded the tomcat zip and unzipped at home location.

Step 1 : Change Tomcat User Name Password and Roles
This is done so that you can login to the Tomcat Application Manager. All you need to do is find the file tomcat-user.xml at location apache-tomcat/conf.

Edit the tomcat-users.xml file.
 Replace the following lines
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->
with the following
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat, manager-gui"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
This will enable us to login to Tomcat Application Manager with user -> tomcat and password -> tomcat. Note: We assigned role -> manager-gui, without this you will not be able to authenticate.

Update the user name, password and roles

Step 2 : Logging into Tomcat Application Manager
Enter the user name and password tomcat, tomcat (or the username, password) that you have set in step 1. This will authenticate you to the Tomcat Application manger
Enter the user name password that was set in step 1
After successful login you will be able to see the following welcome screen.
Tomcat Application Manager welcome screen
Step 3 : Deploy the war file that we want.
Click on the Choose File button, and choose the war file that you want to deploy to the tomcat.
Click on Choose File to select the war file to be deployed
Choose the war file from system
Step 4: Start the application
Once the file is uploaded and deployed you will be able to see this application in the application manager. You can start, stop, reload, undeploy the war from here.
Our application test is loaded and is visible on application manager
Step 5: Run the application
Just click on the ling representing your application and it will launch our application.


No comments :

Post a Comment