Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

site transfer context path problem

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
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
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
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic