How to deploy web applications on Tomcat

In this tutorial, we describe 2 ways for deploying Java web applications on Tomcat application server.

1. War file

The typical way for deploying a Java web application on Tomcat is to archive the application in a WAR file and deploy the file directly under {TOMCAT_HOME}/webapps.

In order to access the application, simply append the name of the war file to the URL of Tomcat.

2. Context file

Another way of deploying the Java web application on Tomcat is to define a context XML file under {TOMCAT_HOME}/conf/Catalina/localhost with the following format:

where docBase attribute points to the location of the web application, and the name of XML defines the application name.

In order to access the application, simply append the name of the context XML file to the URL of Tomcat.

Hussein Terek

Founder of programmergate.com, I have a passion in software engineering and everything related to java environment.

You may also like...

Leave a Reply

avatar