Deploying a WAR Application

Harry · 12 Sep 2026 · 8 views

What is a WAR?

A WAR (Web Application Archive) packages your webapp: classes, JSPs, static resources and a WEB-INF/web.xml. Tomcat loads it into a context.

Standard Layout

myapp.war
├── WEB-INF/
│   ├── web.xml
│   ├── classes/
│   └── lib/
├── index.jsp
└── static/...

Manual Deployment

cp myapp.war webapps/myapp.war
# Tomcat detects it and deploys automatically (autoDeploy)
curl -I http://localhost:8080/myapp/

Deploy via the Manager App

Configure users in conf/tomcat-users.xml:

<role rolename="manager-gui"/>
<user username="admin" password="change-me" roles="manager-gui,manager-script"/>

Then deploy from the Manager web UI or via curl:

curl -u admin:change-me \
  -F "file=@myapp.war" \
  http://localhost:8080/manager/text/deploy?path=/myapp

Contexts and Default App

  • Deploying a WAR named ROOT.war makes it appear at /.
  • A context path maps URL to app: /myapp = the myapp.war context.
  • Exploded deployment: extract the WAR to a directory so you can edit files without redeploying.

Key Points

  • autoDeploy watches webapps/ - just copy the WAR in.
  • Manager gives you deploy/undeploy/start/stop without filesystem access.
  • ROOT.war becomes the site homepage.
Share this post:

Comments (0)

Please login or register to comment.