• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Replacing the root context

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

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

http://127.0.0.1/mywebsite/

Rather I want this:

http://127.0.0.1/

Thanks,

S
 
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.

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/context.html

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!

Jimbus
[ December 07, 2004: Message edited by: Jim Babcock ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic