• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Changing Tomcat Context in server.xml

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I know this should be a simple operation but am having trouble changing my Tomcat context. I've scanned previous posts & the net but still not been able to sort it out.

E.g. A domamin: www.example.co.uk is pointing to webapps/ROOT and displaying the Tomcat home page. Fine. However, how can i make it display whats in webapps/marcus instead? For example's sake, an index.html is all configured and ready to go in the marcus application.

I'm thinking i need to add something like this in server.xml:
<Context path="/" docBase="webapps/marcus" crossContext="false" debug="0" reloadable="true"/>

This doesn't seem to be working though. Any advice would be greatly appreciated....
 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This will be moved out of this forum and into the tomcat forum by one of the sheriffs soon. But while we have it - here we go.

1. You shouldnt be adding context definitions to your servr.xml.
2. Create an xml with the same name as your context and store it in <TOMCAT_ROOT>/CONF/CATALINA/LOCALHOST/<CONTEXT_NAME>.xml
3. The xml contains exactly what you posted.
4. Finally if you need to have this context as the root, the context name has to be ROOT.xml

ram.
 
Marcus Hathaway
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This will be moved out of this forum and into the tomcat forum by one of the sheriffs soon. But while we have it - here we go.



Sorry must have missed the Tomcat forum!


1. You shouldnt be adding context definitions to your servr.xml.



Intesting you say this because this is how my hosting company have instructed me to change the deafult setup....

Thanks for the comments above will give this a go regardless and see what happens....

Thanks again!

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey marcus, i have created a solution document on your problem , if you want that , then please give me your Mail ID so that i can forward you that,
 
Ranch Hand
Posts: 1211
Mac IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Marcus Hathaway:

<Context path="/" docBase="webapps/marcus" crossContext="false" debug="0" reloadable="true"/>

This doesn't seem to be working though. Any advice would be greatly appreciated....



Hi Marcus,

I haven't tested it, but try -

<Context path="/" docBase="marcus" crossContext="false" debug="0" reloadable="true"/>

Cheers.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this
<Context path="" docBase="marcus" crossContext="false" debug="0" reloadable="true"/>
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Marcus,

Just try this.I done the following configuration in the tomcat and its working fine.

You said that you need to confogure ur webapplication which is in the path
webapps/reddy. Say reddy is ur webapplication.

Put the following configuration in the below folder under the file reddy.xml

$CATALINA_HOME/conf/Catalina/localhost/reddy.xml

<Context docBase="reddy" path="/" crossContext="false"/>
save the reddy.xml file

If any of the application is pointing like the above way please remove that configuration.
In general ROOT will have the above configuration just remove that from ROOT.xml.

Now Resart ur Tomcat server.

Open IE and type http://www.example.co.uk
The index file in the reddy webapplication will be invoked.


Reddy
 
Won't you be my neighbor? - Fred Rogers. tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic