Start here: complete step-by-step guides

Run a WAR, JSP or servlet app on Tomcat, step by step

Java web apps (a .war file, JSP pages, servlets) run on Apache Tomcat 9, 10.1 or 11 on every Java plan. Upload the WAR and it is live at your domain.

  1. Launch a Java app
  2. Build the WAR
  3. Upload it
  4. Or deploy from GitHub
  5. Which Tomcat version runs
  6. Settings, databases and logs
  7. Memory

1. Launch a Java app

Launch an app → Blueprint Java → the Java version your app needs (21 if unsure) → a plan → your domain → pay. Tomcat is already installed; you do not install or configure it.

2. Build the WAR

On your computer build the app as usual, for example with Maven. The file is in target/. Rename it ROOT.war if you like (any name works).

mvn -DskipTests package
# → target/myapp.war

3. Upload it

Open File manager (it opens in the app folder, web/yourdomain.com/app), upload the .war, then App settings → Restart. A few seconds later the app answers at the root of your domain: https://yourdomain.com/, not /myapp/. An unpacked app (a folder with WEB-INF in it) works too.

Or deploy from GitHub

Connect the repository under Git deployments. With a pom.xml (or mvnw), each push runs mvn package and the new WAR goes live, with automatic rollback if it does not start.

Which Tomcat version runs

We read your app. Code for javax.servlet (Java EE, most apps written before 2021) runs on Tomcat 9; jakarta.servlet code runs on Tomcat 10.1. To choose yourself, set App settings → Start command to one of these lines. Tomcat 11 needs Java 17 or later.

cn-tomcat 9
cn-tomcat 10.1
cn-tomcat 11

Settings, databases and logs

  • Database passwords and settings go in App settings → Environment variables; read them with System.getenv("DB_URL")
  • MariaDB, MySQL and PostgreSQL databases are created under Databases; use localhost as the host
  • Tomcat's own messages and your app's logs are in App settings → Logs
  • HTTPS and the visitor's real IP are passed to your app (request.isSecure(), request.getRemoteAddr())

Memory

Java uses 70% of your plan's app RAM for its heap. If the app runs out of memory, upgrade to a plan with more RAM.

Stuck? Our engineers answer support tickets around the clock. Contact us, or create an account and open a ticket from the dashboard — the same guides are there too.

Next step

Move your site, or your whole cloud estate

Shared hosting you can buy in two minutes. Infrastructure and managed services quoted by an engineer within one business day.