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-name>A</display-name>
  <!--Spring Configuration for services.xml-->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:/services.xml</param-value>
  </context-param>
  <filter>
    <filter-name>struts-cleanup</filter-name>

<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
  </filter>
  <filter>
    <filter-name>sitemesh</filter-name>

<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
  </filter>
  <filter>
    <filter-name>struts</filter-name>

<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts-cleanup</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>struts</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <!--Spring Configuration for the Listener-->
  <listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <servlet>
    <servlet-name>jspSupportServlet</servlet-name>

<servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
    <load-on-startup>10</load-on-startup>
  </servlet>
  <welcome-file-list>
    <welcome-file>index.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-name>B</display-name>
  <!--Spring Configuration for services.xml-->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:/services.xml</param-value>
  </context-param>
  <filter>
    <filter-name>struts-cleanup</filter-name>

<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
  </filter>
  <filter>
    <filter-name>sitemesh</filter-name>

<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
  </filter>
  <filter>
    <filter-name>struts</filter-name>

<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts-cleanup</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>struts</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <!--Spring Configuration for the Listener-->
  <listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <servlet>
    <servlet-name>jspSupportServlet</servlet-name>

<servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
    <load-on-startup>10</load-on-startup>
  </servlet>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

"Have you changed the conf/context.xml file?  (Usually a bad idea.)"
I don't think I have. Here is what is in it:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>

"Do you have a context.xml file anywhere else?  (You shouldn't.)"
I don't think so.
[EMAIL PROTECTED] tomcat5]$ locate context.xml |grep $CATALINA_HOME
$CATALINA_HOME/conf/context.xml

"Do you have any .xml files in conf/Catalina/localhost?  If so, what are
their names, and what's in them?"
Yes.
>$CATALINA_HOME/conf/Catalina/localhost/host-manager.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="${catalina.home}/server/webapps/host-manager"
privileged="true" antiResourceLocking="false" antiJARLocking="false">
</Context>
>$CATALINA_HOME/conf/Catalina/localhost/manager.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="${catalina.home}/server/webapps/manager" privileged="true"
antiResourceLocking="false" antiJARLocking="false">
  <ResourceLink name="users" global="UserDatabase"
type="org.apache.catalina.UserDatabase"/>
</Context>
>$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>

Does it look I should be able to access both A and B if both A and B are in
the webapps directory with this configuration using the urls
http://localhost:8080/A and http://localhost:8080/B respectively?

Thanks,
Elliot


On Wed, Jul 9, 2008 at 4:39 PM, Caldarale, Charles R <
[EMAIL PROTECTED]> wrote:

> > 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]
>
>


-- 
Elliot

Reply via email to