wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Changing Tomcat Context in server.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Changing Tomcat Context in server.xml" Watch "Changing Tomcat Context in server.xml" New topic
Author

Changing Tomcat Context in server.xml

Marcus Hathaway
Ranch Hand

Joined: Jun 07, 2005
Posts: 89
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

Joined: Jan 24, 2005
Posts: 489

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

Joined: Jun 07, 2005
Posts: 89
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

Joined: Sep 21, 2005
Posts: 126
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

Joined: Feb 02, 2002
Posts: 1211

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

Joined: Mar 27, 2006
Posts: 4
Try this
<Context path="" docBase="marcus" crossContext="false" debug="0" reloadable="true"/>
Udayakumar Reddy
Greenhorn

Joined: Mar 24, 2006
Posts: 7
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Changing Tomcat Context in server.xml