Re: How to configure multiple web applications in a single host
Chuck, Thanks so much for your help with this. Unfortunately it still isn't working though. I decided to try and start over. So I did rm -rf $CATALINA_HOME and then re-created $CATALINA_HOME. So I have a clean install of apache-tomcat-5.5.26. I did not modify anything in $CATALINA_HOME/conf. I did do: $ rm -rf $CATALINA_HOME/webapps/* to start out with a clean webapps directory. Then, I extracted A.war in $CATALINA_HOME/webapps/A and B.war in $CATALINA_HOME/webapps/B I did as you said and added A/META-INF/context.xml and B/META-INF/context.xml. Both of them have this content: ?xml version=1.0 encoding=UTF-8? Context ResourceLink name=users global=UserDatabase type=org.apache.catalina.UserDatabase/ /Context Once again, only one of the applications will work and the other one gives a 404 error. I've unsuccessfully tried every possible configuration that I can think of to get both applications to be served simultaneously. Do you have any other suggestions or could you post a working example of the configuration files that I would need to get both A and B to be served at the same time? Thanks so much for your help. Cheers On Wed, Jul 9, 2008 at 9:14 PM, Caldarale, Charles R [EMAIL PROTECTED] wrote: From: Elliot Huntington [mailto:[EMAIL PROTECTED] Subject: Re: How to configure multiple web applications in a single host $CATALINA_HOME/conf/Catalina/localhost/A.xml ?xml version=1.0 encoding=UTF-8? Context path= docBase=${catalina.home}/webapps/A ResourceLink name=users global=UserDatabase type=org.apache.catalina.UserDatabase/ /Context $CATALINA_HOME/conf/Catalina/localhost/B.xml ?xml version=1.0 encoding=UTF-8? Context path=/B docBase=${catalina.home}/webapps/B ResourceLink name=users global=UserDatabase type=org.apache.catalina.UserDatabase/ /Context Bingo - both of the above are causing you problems. If you want one of the webapps to be the default webapp for the Host, it must be named ROOT (case-sensitive). Do not attempt to force it to happen with the path attribute, that will simply confuse things (as you've noticed). Also, supplying a docBase attribute that points into the Host appBase directory will result in multiple deployments of your webapps, which is usually quite undesirable. To fix this, remove both the A.xml and B.xml files from conf/Catalina/localhost. Remove any existing ROOT directory or .war file from the webapps directory. Change the directory name of A to ROOT. Create these two files: $CATALINA_HOME/webapps/ROOT/META-INF/context.xml $CATALINA_HOME/webapps/B/META-INF/context.xml Both will contain the following (and just the following): ?xml version=1.0 encoding=UTF-8? Context ResourceLink name=users global=UserDatabase type=org.apache.catalina.UserDatabase/ /Context Note that the path and docBase attributes must not be used here. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Elliot
RE: How to configure multiple web applications in a single host
From: Elliot Huntington [mailto:[EMAIL PROTECTED] Subject: How to configure multiple web applications in a single host If I only put one of the web applications in the webapps folder (either of them) then that single web application will work properly. What exactly do you mean by put one of the web applications in the webapps folder? $CATALINA_HOME/webapps/ $CATALINA_HOME/webapps/A/ $CATALINA_HOME/webapps/A/... $CATALINA_HOME/webapps/B/ $CATALINA_HOME/webapps/B/... The above is correct, as far as it goes. You would reference each webapp with the URLs: http://localhost:8080/A http://localhost:8080/B Is that what you're trying? Do you have a META-INF/context.xml file under either the A or B directories? If so, what's in it? Do you have a WEB-INF/web.xml file under either the A or B directories? If so, what's in it? Have you changed the conf/context.xml file? (Usually a bad idea.) Do you have a context.xml file anywhere else? (You shouldn't.) Do you have any .xml files in conf/Catalina/localhost? If so, what are their names, and what's in them? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to configure multiple web applications in a single host
Thank you for your quick response. When I say put one of the web applications in the webapps folder I mean that if the webapps folder looks like either: $CATALINA_HOME/webapps/ $CATALINA_HOME/webapps/A/ $CATALINA_HOME/webapps/A/... or $CATALINA_HOME/webapps/ $CATALINA_HOME/webapps/B/ $CATALINA_HOME/webapps/B/... Then I can access the web application by either http://localhost:8080/A if A is the only application in webapps or http://localhost:8080/B if B is the only application in the webapps folder. But if both A and B in in webapps: $CATALINA_HOME/webapps/ $CATALINA_HOME/webapps/A/ $CATALINA_HOME/webapps/A/... $CATALINA_HOME/webapps/B/ $CATALINA_HOME/webapps/B/... Then I can only access A or I can only access B. Which one I can access depends on which one I deployed first. So if A was the only application in webapps and everything is working fine, and I stop the tomcat server and then add B to webapps and start the server, then I can access A but get a 404 when I try to access B. However, If B is the only application in the webapps folder and everything is working fine and I stop the server and then add A to the webapps folder and restart tomcat, then I will be able to access B but I will get a 404 error when I try to access A. If I stop the server, remove both A and B from webapps and then start the server and go the http://localhost:8080/ then the web browser (Firefox 3) will show a blank page. Then if I stop the server, put both A and B in webapps and start the server, then I will be able to access A and get a 404 when I try to access B. Do you have a META-INF/context.xml file under either the A or B directories? If so, what's in it? No. I don't have META-INF/context.xml in either A or B. Do you have a WEB-INF/web.xml file under either the A or B directories? If so, what's in it? Yes. A/WEB-INF/web.xml: ?xml version=1.0 encoding=ISO-8859-1? web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 display-nameA/display-name !--Spring Configuration for services.xml-- context-param param-namecontextConfigLocation/param-name param-valueclasspath:/services.xml/param-value /context-param filter filter-namestruts-cleanup/filter-name filter-classorg.apache.struts2.dispatcher.ActionContextCleanUp/filter-class /filter filter filter-namesitemesh/filter-name filter-classcom.opensymphony.module.sitemesh.filter.PageFilter/filter-class /filter filter filter-namestruts/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class /filter filter-mapping filter-namestruts-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namesitemesh/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namestruts/filter-name url-pattern/*/url-pattern /filter-mapping !--Spring Configuration for the Listener-- listener listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener servlet servlet-namejspSupportServlet/servlet-name servlet-classorg.apache.struts2.views.JspSupportServlet/servlet-class load-on-startup10/load-on-startup /servlet welcome-file-list welcome-fileindex.html/welcome-file /welcome-file-list /web-app B/WEB-INF/web.xml: ?xml version=1.0 encoding=ISO-8859-1? web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 display-nameB/display-name !--Spring Configuration for services.xml-- context-param param-namecontextConfigLocation/param-name param-valueclasspath:/services.xml/param-value /context-param filter filter-namestruts-cleanup/filter-name filter-classorg.apache.struts2.dispatcher.ActionContextCleanUp/filter-class /filter filter filter-namesitemesh/filter-name filter-classcom.opensymphony.module.sitemesh.filter.PageFilter/filter-class /filter filter filter-namestruts/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class /filter filter-mapping filter-namestruts-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namesitemesh/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namestruts/filter-name url-pattern/*/url-pattern /filter-mapping !--Spring Configuration for the Listener-- listener listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener servlet servlet-namejspSupportServlet/servlet-name servlet-classorg.apache.struts2.views.JspSupportServlet/servlet-class load-on-startup10/load-on-startup /servlet
RE: How to configure multiple web applications in a single host
From: Elliot Huntington [mailto:[EMAIL PROTECTED] Subject: Re: How to configure multiple web applications in a single host $CATALINA_HOME/conf/Catalina/localhost/A.xml ?xml version=1.0 encoding=UTF-8? Context path= docBase=${catalina.home}/webapps/A ResourceLink name=users global=UserDatabase type=org.apache.catalina.UserDatabase/ /Context $CATALINA_HOME/conf/Catalina/localhost/B.xml ?xml version=1.0 encoding=UTF-8? Context path=/B docBase=${catalina.home}/webapps/B ResourceLink name=users global=UserDatabase type=org.apache.catalina.UserDatabase/ /Context Bingo - both of the above are causing you problems. If you want one of the webapps to be the default webapp for the Host, it must be named ROOT (case-sensitive). Do not attempt to force it to happen with the path attribute, that will simply confuse things (as you've noticed). Also, supplying a docBase attribute that points into the Host appBase directory will result in multiple deployments of your webapps, which is usually quite undesirable. To fix this, remove both the A.xml and B.xml files from conf/Catalina/localhost. Remove any existing ROOT directory or .war file from the webapps directory. Change the directory name of A to ROOT. Create these two files: $CATALINA_HOME/webapps/ROOT/META-INF/context.xml $CATALINA_HOME/webapps/B/META-INF/context.xml Both will contain the following (and just the following): ?xml version=1.0 encoding=UTF-8? Context ResourceLink name=users global=UserDatabase type=org.apache.catalina.UserDatabase/ /Context Note that the path and docBase attributes must not be used here. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]