This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Need help with multiple contexts for a webapp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Need help with multiple contexts for a webapp" Watch "Need help with multiple contexts for a webapp" New topic
Author

Need help with multiple contexts for a webapp

Jeremy Muchler
Greenhorn

Joined: Sep 09, 2011
Posts: 1
I've been trying to get multiple context names to link to a single webapp (without running multiple copies of the application itself).

I have a deployed webapp running on a Tomcat server. If you go to the URL, it works (which is great). Say the URL is http://support.company.com/webapp. What we are trying to do is to be able to have http://support.company.com/customer1 run the webapp and keep a reference to the custom url (so that all the pages will have support.company.com/customer1/login.jsp etc in the address bar). Total we will have at least a dozen different names pointing at the same web app. Because the application itself is rather memory intensive, we are trying to avoid running multiple copies of the app. Because of decisions from the marketing team, we can't use sub-domains of the company.com name so I haven't investigated using virtual hosts.

I was able to setup the contexts so that they work by adding them to the server.xml file, but I ran into issues with the web app trying to cache itself four times (three contexts, plus the "real" name) which would cause the server to grind to a halt and the catalina.out to throw tons of errors. I have tried to setup context files in /webapps/ and in the Meta-INF folder of the webapp itself, but either the web app would fail to load because of a malformed context file, or in the catalina logs i would see where the entries were being ignored (due to setting a path that is already within the app path).

I am not opposed to putting in the work to setup Apache+Tomcat if necessary. We haven't done so to date because this web server only runs the webapp and nothing else.

Any ideas on how to get this craziness to work?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Need help with multiple contexts for a webapp
 
Similar Threads
Debuging Eclipse Java Project as External Web Application - debug view not in sync with code
site transfer context path problem
Giving each webapp its own context root
Displaying a random picture in a JSP file
Loading a text doc into a browser