Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7577599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:13:44+00:00 2026-05-30T17:13:44+00:00

If I deploy a war file to Tomcat, called for example foo-bar-1.1.2.war , how

  • 0

If I deploy a war file to Tomcat, called for example foo-bar-1.1.2.war, how can I deploy it so that it is extracted to webapps/bar and its URL root is /bar/…?

My intention here is to keep the war file in the webapps server with its version information so that I know which version is installed but have it overwrite a previous version of the app.

I could deploy the war file using PSI Probe. This would allow me to specify a target context for the web app. However, it means that I would lose any version information in the war file name.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:13:45+00:00Added an answer on May 30, 2026 at 5:13 pm

    Tomcat will always extract the contents of a war file, to a folder of the same name (when it’s configured to deploy wars – as default etc.).

    You can extract it to a folder name of your choice. So if you unzip the contents of foo.war to a folder called bar/ manually, instead of just dropping the war into the web apps folder, it’ll still load the web application.

    However, this is totally unnecessary as you can specify the URL pattern of the application without messing with the folder / war file name at all by overriding the context root element for your application:

    This is often set in the Tomcat server.xml – but that practice is fairly widely discouraged. Instead, I’d suggest you use context.xml in the META-INF folder of your web application / war file:

    <Context path="/bar" .../>
    

    When the application is deployed, the context.xml should be copied to /conf/Catalina/localhost but renamed to foo.xml

    Note that conext roots must be unique and there are some additional considerations if you’re using the autoDeploy or deployOnStartup operations (Source http://tomcat.apache.org/tomcat-7.0-doc/config/context.html).


    Other options include:

    • Clean the web apps folder each deployment and drop your new foo-1.1.0 war in.
    • Include the version number in a flat file. foo/version1
    • Or simply include the version in a config / XML file.

    You could also use Ant (or an equivalent tool) to automate your deployments (and perform any of the above).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to deploy a given war file on Tomcat server? I
When I deploy my war file in tomcat, the SEVERE errors thrown by Catalina
I'm trying to deploy a war file onto my server which is tomcat 6
I am trying to deploy a war file to tomcat 6.0.27. This war file
I've got a WAR that i need to deploy with TomCat, but i'm not
I have copied the sample.war file into the webapps directory of Tomcat, and I
When I try to deploy and run the war file on tomcat 7 I
I've created a Play 1.2.3 app and I'm trying to deploy its war file
I'm attempting to deploy to a war file in Tomcat 7. It's giving me
Is it possible to deploy a remote war file automatically when my tomcat (6)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.