• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing Tomcat Context in server.xml

 
Marcus Hathaway
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • 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....
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
  • 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!

 
Gaurav Chhabras
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • 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,
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • 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.
 
Kalpesh Patel
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this
<Context path="" docBase="marcus" crossContext="false" debug="0" reloadable="true"/>
 
Udayakumar Reddy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic