• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Replacing the root context

Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I want to replace Tomcats root application with my own so that I don't have to have this URL:

Rather I want this:


Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a question?

But seriously... you want to replace the existing "default application" with yours.


3rd paragraph makes reference to the default application. You should be able to find it in server.xml
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try looking in at the application you are answering for before giving snotty answers. Some of us look at the documentation before we ask questions, thank you very much.

There is no default context defined in a bare tomcat installation, there is only the server, service and host. The host has an appBase defined as TOMCAT_BASE/webapps and by default the defaultcontext has its path set to "ROOT". I looked everywhere I could think of and could not find "ROOT" defined in an XML file... I suspect its a hard coded default in a class somewhere (kind of cheesy if true .

I've been struggling with this for more than a week and have see the question, unanswered, on almost every forum I've checked... but I figured it out, today.

Reading the config and the docs, they say they no longer want you put Contexts in server.xml. Tomcat builds a directory structure based on Severice and Host in conf (Catalina/localhost) and thats where you'll find the XML configs for admin, balancer and jsp-examples. All of your applications should build context files here. You can put a DefalutContext in your server.xml, but there is apparently no docBase as in a regular Context, so that doesn't help move "/" to a alternate directory tree.

I tried moving the Host's appBase to point where I wanted, but that broke everything. I was trying that today and noticed that the "admin/" still worked, even when "/" did not and that pointed me to my answer.

Find admin.xml, copy it into a file named default.xml (actual name is not important). Edit the file, change the path from "admin/" to "/" and change the docBase to where you want to point to (I used /usr/home/appadmin/deck/production) and voila! You'll still have to make sure your WEB_INF and such are in the right spots, but that works for me.

Have Fun!

[ December 07, 2004: Message edited by: Jim Babcock ]
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic