aspose file tools*
The moose likes Tomcat and the fly likes site transfer context path problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "site transfer context path problem" Watch "site transfer context path problem" New topic
Author

site transfer context path problem

John Davis
Ranch Hand

Joined: Nov 02, 2000
Posts: 189
I have a Tomcat installation which hosts half a dozen applications. I installed these applications using File URL option and specifying a context path. This works fine. A user's URL looks like this:


The problem is that I want to migrate another web application to this Tomcat installation. Coming in port 80 serves up the Tomcat Manager application. To get any of my applications served I need to specify a context path. How do I get the Tomcat to serve the newly migrated application without specifying a context path ( /pathName ) in the URL?
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

So if you don't want a context path, how will tomcat tell one application from another?

(the quick answer is: it can't)

more involved: Let's say you have a deployable WAR file named foo.war. It has servlets mapped to /abc and /xyz. Let's further say I wish to deploy foo.war twice (two instances of the same app).

http://www.mydomain.com/abc <- here I mean instance 1
http://www.mydomain.com/xyz <- here I mean instance 2

but how is Tomcat to know?

Ok... then two apps that never map any of the same paths. They should all just get along.. nope. There should be a 100% reliable way to determine one application from another. Thus, contextPath.

The solution in general, and for you specifically, is to use multiple hosts, and to have each host's *default* application, be an instance of the app you want.

http://app1.mydomain.com/abc
http://app2.mydomain.com/xyz

Here, Tomcat can determine which app to serve.

fyi: Tomcat comes with the default app for the default host.. the one you're seeing when you come in through port 80.
[ October 18, 2004: Message edited by: Mike Curwen ]
John Davis
Ranch Hand

Joined: Nov 02, 2000
Posts: 189
Mike,

You wrote

"The solution in general, and for you specifically, is to use multiple hosts, and to have each host's *default* application, be an instance of the app you want."

I think I am beginning to get an idea of what you mean but I am still not clear on this. What do you mean "use multiple hosts"? I have just one machine.

I have about 6 web apps which I developed to run on this Tomcat and each has its own context path.

The web app I want to run on this Tomcat is running on another host computer and I want to move it my Tomcat. The url for this web app is well known (printed on business cards etc.) and does not have a context path in it (it ran on a Blazix application server).

When I look at my web apps listing in Tomcat Manager , it lists "welcome to Tomcat with a context path of "/". Now, this is a useful application and I use it to select "Tomcat Manager" and "Tomcat Administration".
It occurs to me that I could use the default app for the web app I want to move to my Tomcat and setup a context path for the "welcome to tomcat app".

Would you happen to know how to do this? When I install the foreign web app using the file URL and leaving context path blank, Tomcat supplies the directory of the web app for a context path.

Also, How do I re-home the "welcome to Tomcat" web app?
 
Consider Paul's rocket mass heater.
 
subject: site transfer context path problem