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 path-to-tomcat/conf
.
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 lines
<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
to our usertomcat
, without this you will not be able to authenticate.
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
After successful login you will be able to see the following 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.
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.
Step 5: Run the application
Just click on the ling representing your application and it will launch our application.
Also Read
No comments: