Problem
Needed to ran 2 applications deployed using war(s) on Tomcat but use different application directories as well as URLs.
Solution
Stop Tomcat
copy the war into the WEBAPPS directory. Ensure that the war has a different name from the other war e.g application2.war
Start Tomcat
Tomcat will deploy the war and create a directory called application2 in the WEBAPPS directory.
Stop tomcat
Go to the WEBAPPS directory and open the application2/WEB-INF/server directory and:
- Add the application2 directory in the context param under (<!– These init parameter(s) are read in by org.xxxx.web.Listener –>)
# pwd /var/lib/tomcat7/webapps # vim application2/WEB-INF/web.xml <context-param> <param-name>application.data.directory</param-name> <param-value>/usr/share/tomcat7/.application2/</param-value> </context-param> <!-- // End init parameters -->
- Add the webAppRootKey context param after (<!– // End init parameters –>)
<context-param> <param-name>webAppRootKey</param-name> <param-value>openmrs-marira</param-value> </context-param>
- Now you can restart Tomcat and you should be apply to access application one under URL http://localhost:8080/application1 and application2 under URL http://localhost:8080/application2