This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.