DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk12 min

How to Set the Tomcat Context Path for a WAR Application

Tomcat derives a WAR application's URL from its filename unless you define an explicit Context. Learn how to deploy at a custom path, use ROOT.war, configure external docBase files, and fix common deployment conflicts.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Tomcat normally derives a WAR application’s context path from the WAR filename. Rename app.war to orders.war and deploy it to the Host’s appBase (often webapps) to serve it at /orders. Name it ROOT.war to serve the application at /. For a path that cannot be represented conveniently by a filename, define a per-Host Context descriptor or deploy through Tomcat Manager.

What the Tomcat context path controls

A Tomcat Context is the routing and deployment boundary for one web application. The context path is the URL prefix Tomcat uses to select that application. If the path is /orders, a request such as https://example.test/orders/checkout is routed to the orders application, while a request beginning with another prefix can be handled by a different Context.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Catalina compares the request URI with the available Context paths and selects the longest matching prefix. The empty context path is the default application. Consequently, the root application handles requests at the host root, whereas a named application retains its prefix in every URL unless the application itself generates links differently.

The context path is independent of the WAR’s internal Java package names and is normally independent of the application’s display name. Changing the path changes where users reach the deployed application; it does not rename classes, servlet mappings, or files inside the archive.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Choose a deployment method

Method Typical use Must the WAR filename change? Where the WAR can live Operational considerations
Filename-derived deployment Simple deployments dropped into a Host appBase Yes Inside the Host’s appBase, commonly webapps Automatic deployment derives the path from the basename; the deployment settings must permit auto-deploy or deploy-on-startup
Per-Host Context XML Stable configuration, custom path, or a WAR outside appBase No Any location allowed by the configured docBase Uses an explicit Context descriptor; the per-Host descriptor takes precedence over a packaged descriptor
Tomcat Manager Interactive or API-driven deployment Usually no, if a path is supplied A WAR or directory supplied to Manager Without a path, Manager uses the WAR filename without .war; explicit WAR or directory input can override an XML docBase
server.xml Context Deployments managed centrally in the server configuration No Defined by the Context’s deployment settings Changes generally require the server configuration lifecycle; use this approach deliberately because Context entries in server.xml are tightly coupled to that file

For a one-off application in the normal appBase, renaming the WAR is the least configuration-heavy option. Use an explicit descriptor when the URL must remain fixed while the artifact filename changes, when the WAR is stored outside appBase, or when deployment needs an explicit docBase.

How Tomcat converts a WAR filename into a context path

Ordinary names

During autoDeploy or deployOnStartup, Tomcat removes the .war extension and uses the remaining basename as the context path. Thus:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
WAR filename Context path Example URL
app.war /app https://example.test/app/
orders.war /orders https://example.test/orders/
ROOT.war Empty path (root Context) https://example.test/

The special basename ROOT is case-sensitive in the conventional deployment layout. It is the filename Tomcat uses to represent the empty context path rather than a literal /ROOT prefix.

Nested paths

Tomcat encodes a multi-level context path in a filename by replacing each slash separator with a hash character. The path /foo/bar is therefore represented by foo#bar.war. This naming convention is useful when automatic deployment is required but the desired URL contains more than one segment.

Desired path Filename
/foo/bar foo#bar.war
/team/reports team#reports.war

Do not put a literal slash in a filesystem filename. Use the hash encoding when the deployment is being derived from the basename.

Set the path by renaming and dropping the WAR

This procedure is appropriate when the WAR will be deployed from the Host’s appBase and the Host allows automatic deployment.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Identify the Host appBase. In a standard installation it is often the webapps directory, but the actual value belongs to the relevant Host configuration. Copying a WAR somewhere else does not make it visible to that Host’s automatic deployer.
  2. Stop or undeploy the old application. If the previous artifact still exists under its old basename, Tomcat can continue to expose the old Context. Remove the old deployment through the same mechanism you used to deploy it, or stop Tomcat before cleaning up files.
  3. Choose the basename from the required URL. Use orders.war for /orders, ROOT.war for the host root, or a hash-encoded name such as foo#bar.war for /foo/bar.
  4. Place the renamed archive in appBase. Copy the file with the final name, for example orders.war, into the configured appBase. Avoid leaving a second copy with a competing basename.
  5. Allow deployment to complete. With autoDeploy or deployOnStartup enabled, Tomcat creates or updates the Context according to the filename. Watch the Catalina log for deployment and startup errors.
  6. Test the resulting prefix. Request the application at /orders, /, or the corresponding nested path. Check a URL that exercises the application rather than relying only on the default welcome page.

Renaming changes the Context path, not the WAR’s contents. If the application has hard-coded absolute links, redirects, cookie paths, or reverse-proxy rules, those components may also need to know the new prefix.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Use a per-Host Context descriptor

An explicit descriptor is useful when the deployment name and public URL should be decoupled. Tomcat supports Context descriptors embedded in the application at META-INF/context.xml, per-Host XML files under $CATALINA_BASE/conf/[enginename]/[hostname]/, and Context elements in server.xml. A per-Host descriptor is normally the clearest choice for a custom path.

Example descriptor for an external WAR

<Context path="/orders" docBase="/srv/apps/orders.war" />
  1. Create the descriptor in the correct Host directory. The directory name must match the Engine and Host that will serve the application. The file name and Host configuration must correspond to the deployment you intend to control.
  2. Set the desired path. In the example, path="/orders" exposes the Context below the /orders prefix.
  3. Set docBase to the WAR or directory. The value points to the application archive or an external exploded directory. Use the path understood by the running Tomcat installation and its filesystem permissions.
  4. Remove conflicting automatic deployments. Do not leave an appBase copy with a different basename if it would create a second Context or an old exploded directory.
  5. Deploy and verify the Context. Restart, reload, or redeploy according to the Host’s deployment settings, then inspect Manager or Catalina logs for the context name and startup result.

The per-Host descriptor takes precedence over a packaged META-INF/context.xml. That precedence lets an operator override an application-supplied descriptor without modifying the WAR.

Important limitation of META-INF/context.xml

A packaged descriptor is not a universal way to rename a WAR that Tomcat is deploying from its filename. When the Host derives deployment from the archive basename, the context path is determined by that filename; Tomcat’s documentation specifically states that the context path may not be defined in an embedded META-INF/context.xml for this deployment model. Use the filename method, a per-Host descriptor, Manager, or server.xml instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When to avoid docBase on an appBase-local WAR

The docBase attribute identifies an external directory or WAR. Tomcat restricts when it should be set for an application located in the Host’s appBase. If the archive is already appBase-local, follow the documented exception for the Tomcat release rather than adding docBase automatically. An unnecessary or conflicting value can cause duplicate deployment or make the configuration harder to reason about.

Deploy with Tomcat Manager

Tomcat Manager can deploy either a WAR archive or an exploded directory. The path behavior depends on what you submit.

Deploying a WAR without an explicit path

If no path parameter is supplied, Manager uses the WAR filename without the .war extension. Uploading orders.war therefore creates the /orders Context. Uploading ROOT.war targets the empty root path according to Tomcat’s normal naming convention.

Deploying with Context XML

A Manager deployment can use a Context XML document containing values such as path and docBase. However, when you also supply a WAR or directory URL, that explicit WAR or directory takes precedence over the XML document’s docBase. Treat the archive or directory URL as authoritative and verify the resulting Context in Manager after deployment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Manager workflow

  1. Open the Manager application’s deployment interface for the target Host.
  2. Choose whether to submit a WAR, a directory, or a Context XML document.
  3. Enter the desired path when the interface provides a path field. Leave it empty only when you deliberately want the basename-derived path.
  4. Submit the deployment and wait for the operation result.
  5. Confirm that the listed Context uses the intended prefix and that its state indicates successful startup.
  6. Remove the old Context if the application was previously deployed under another path and is no longer needed.

Manager labels and available operations can vary with the Tomcat release and its security configuration. Use the interface exposed by the version you operate, and do not assume that an XML docBase will win when an archive URL is supplied separately.

Deploy the root application at /

To make a WAR answer at the host root, name it ROOT.war when using filename-derived deployment. The resulting Context has an empty path, so a request to https://example.test/ enters that application without an application prefix.

Before deploying a new root application, remove or undeploy the existing root Context. A stock Tomcat installation commonly includes a default root application; leaving both the old exploded directory and the new archive in place can produce stale content or an unexpected deployment result. Clean up the old root deployment using the same lifecycle method used for the replacement, then inspect logs and request the root URL.

Root deployment also changes how relative and absolute links appear to users. An application that was previously tested under /orders may contain assumptions about that prefix, so test redirects, static resources, session cookies, and links after moving it to the empty path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Control packaged descriptors with Host deployment settings

deployXML

When deployXML is false, Tomcat ignores Context descriptors packaged inside applications. A WAR can therefore contain META-INF/context.xml and still deploy without that descriptor being applied. This setting is an intentional policy control, not an indication that the XML is malformed.

copyXML

The Host’s copyXML setting controls whether a packaged descriptor is copied into the per-Host configuration area. Its interaction with deployXML matters when administrators want to prevent application archives from supplying deployment configuration.

Both settings disabled

With both deployXML and copyXML set to false, only Contexts defined in server.xml deploy. Changes to those Contexts require a restart. This arrangement gives the central server configuration control over deployment but removes the convenience of changing a per-application descriptor independently.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

If an embedded descriptor appears to be ignored, inspect the effective Host settings before editing the WAR. A false deployXML value deliberately produces that behavior.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Understand precedence and avoid duplicate Contexts

Several deployment inputs can describe the same application: a WAR basename, a packaged descriptor, a per-Host XML file, a Manager request, and a server.xml entry. Problems often arise when more than one input remains active after a path change.

  • A per-Host XML descriptor overrides a packaged META-INF/context.xml.
  • Filename-derived deployment uses the basename to determine the Context path; an embedded descriptor cannot be used as a general rename mechanism for that process.
  • An explicitly supplied WAR or directory URL in Manager overrides the XML document’s docBase.
  • A Context defined in server.xml is the controlling definition when Host settings allow only server.xml Contexts.
  • An old exploded directory can remain after an archive is renamed. Remove stale deployment artifacts or undeploy the old Context before testing the new one.

Pick one authoritative deployment path for each application. Keeping an appBase archive, a per-Host descriptor, and a server.xml entry for the same intended URL makes the result dependent on precedence rules rather than on one clear configuration.

Changing an external directory or symlink target

The docBase can point to an external directory or WAR. This allows the public Context path to remain stable while the application files are stored outside appBase. It is also useful for release layouts that switch an external directory or symlink.

Do not assume that changing a symlink target is handled by a simple Context reload. Tomcat’s Context reference requires a restart or an undeploy followed by a redeploy for symlink changes. Plan that lifecycle operation explicitly, and verify which version of the application is serving requests after the change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When switching releases, keep the Context path unchanged, update the external target, perform the required restart or undeploy/redeploy, and then check the Catalina log for the new deployment. A successful filesystem change alone does not prove that the running web application has changed.

Verification checklist

  • URL prefix: Confirm that the application responds at the intended path, such as /orders, the root /, or a hash-encoded nested path.
  • Context listing: Check Tomcat Manager, when available, for the deployed context name and running state.
  • Startup logs: Review Catalina logs for deployment messages, startup failures, missing files, permission errors, or an unexpected context name.
  • Artifact cleanup: Remove the old WAR basename and stale exploded directory when moving an application from one path to another.
  • Descriptor policy: If a packaged descriptor was ignored, inspect the Host’s deployXML value and determine whether that behavior is intentional.
  • Application-generated URLs: Test redirects, static resources, forms, cookies, and links because changing the Context prefix can expose assumptions inside the application.
  • Host selection: Ensure that the request reaches the intended virtual Host; the same path can exist on different Hosts with different applications.

Troubleshooting common path problems

The application still opens under its old filename

Look for the old WAR and its exploded directory in appBase. Automatic deployment can preserve the old Context while the newly named archive creates another one. Undeploy the old Context or remove its obsolete artifacts using the appropriate lifecycle, then redeploy the renamed archive.

The application opens at /app instead of /orders

Tomcat is probably still seeing app.war or an old exploded app directory. Rename the archive to orders.war, remove the old deployment, and check the logs for the Context name created during startup.

META-INF/context.xml did not change the URL

For filename-derived auto-deployment, the basename determines the path, so the embedded descriptor is not a reliable rename mechanism. Also check whether deployXML=false disables packaged descriptors. Use a per-Host descriptor, Manager path, server.xml Context, or the correct WAR basename.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The external WAR is not found

Validate the docBase spelling, filesystem permissions, and whether the descriptor is in the configuration directory for the Host receiving the request. If the archive is appBase-local, remove an unnecessary docBase and follow the deployment rule for that layout.

The new root application does not appear

Check for the stock root application, an old ROOT directory, or another root Context defined in configuration. Only one application can own the empty path for a given Host. Clean up the previous deployment, redeploy ROOT.war, and inspect startup logs.

A symlink switch appears to have had no effect

A reload is not sufficient for the symlink-change case described by Tomcat’s Context reference. Restart Tomcat or undeploy and redeploy the Context, then verify the served build through the application and its logs.

Practical decision guide

  • Use a renamed WAR when the artifact is in appBase, the filename can follow the URL, and you want the fewest moving parts.
  • Use ROOT.war when this application must be the default for a Host and the empty context path is intentional.
  • Use hash encoding when automatic deployment is required for a multi-segment path such as /foo/bar.
  • Use a per-Host descriptor when the URL must stay stable while the WAR filename or storage location changes, or when the WAR is outside appBase.
  • Use Manager when an operator or deployment process needs to provide an explicit path interactively or through the Manager interface.
  • Use server.xml when deployment policy requires all Contexts to be centrally declared and the resulting restart requirement is acceptable.

The safest configuration is the one with one clear owner for the path. Decide whether the filename, a per-Host descriptor, Manager, or server.xml is authoritative, remove competing artifacts, and verify the resulting Context in both the URL and the Tomcat logs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.