• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Carey Brown
  • Frits Walraven

How to setup multiple web context paths for same docbase in Tomcat

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to setup 2 web context paths /app1 and /app2 pointing to same docBase. It's working fine in local with below configuration


In remote server, I don't have control on server.xml. How can I do this using context.xml? Is there any other way?
Saloon Keeper
Posts: 21981
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You actually shouldn't be using server.xml that way.

The proper way to do this is to create 2 files in TOMCAT_HOME/conf/Catalina/localhost named "app1.xml" and "app2.xml". Tomcat will use the names of those files to create the contexts. Note that Tomcat will ignore the "path=" attribute. It's the name of the context file, not the contents of the file that determines the context path.

Also, so be aware that each context represents a separate instance of the webapp, even though they have a common codebase. If you actually wanted the same webapp to respond on both context paths, a different approach is required.
No matter how many women are assigned to the project, a pregnancy takes nine months. Much longer than this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
    Bookmark Topic Watch Topic
  • New Topic