Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to Deploy a WAR File

This guide shows how to put a Java web application online using a WAR file and Apache Tomcat.

Web Hosting2 min read11 steps

What is a WAR file?

A WAR file is a single package that holds a whole Java web application. WAR stands for Web Application Archive. It is like a zip file that contains your pages, code and settings. To deploy means to place the application on a server so people can use it.

What is Tomcat?

Tomcat is a free program that runs Java web applications. It unpacks your WAR file and serves the pages. Your hosting plan must include Java and Tomcat support. Ask Hostvento support whether yours does.

Before you start

  • Have your .war file ready.
  • Know where Tomcat is installed, or have your control panel login.
  • Back up any existing application with the same name. Deploying can replace it.

Method 1: Using the Tomcat folder

  1. Connect to your server with FTP or SSH. FTP moves files to your hosting. SSH lets you type commands on a server.
  2. Find Tomcat's webapps folder. The path is often /opt/tomcat/webapps, but it can differ.
  3. Upload your WAR file, for example myapp.war, into webapps.
  4. Wait a short time. Tomcat unpacks the file by itself and creates a folder named myapp.
  5. Open http://your-domain:8080/myapp in a browser. Port 8080 is the usual Tomcat door, but yours may differ.

Method 2: Using the Manager page

  1. Open the Tomcat Manager page in your browser. It is often at http://your-domain:8080/manager/html.
  2. Log in with the manager user name and password.
  3. Scroll to the section WAR file to deploy.
  4. Click Choose File and pick your WAR file.
  5. Click Deploy.
  6. Your app appears in the list. Click its name to open it.

Restart Tomcat if needed

systemctl restart tomcat

This restarts Tomcat. It needs root access, which is full admin control of a server. The service name may differ.

If it does not work

  • Read the log file. It is often in the Tomcat logs folder, named catalina.out.
  • Check that the Java version matches what your app needs.
  • Check the file name, because it becomes part of the web address.

Still stuck? Open a support ticket.

Quick recap

  • A WAR file is a packaged Java web app.
  • Tomcat runs it.
  • Copy it to webapps, or use the Manager page.
  • Open the app by its file name in the address.
  • Check logs if there are errors.