You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by puttea <pu...@gmail.com> on 2010/03/15 16:00:57 UTC

Problem setting up multiple hosts

Hi all

I'm running tomcat 5.5 on one of my servers. This server is hosting one
webapp at the moment which is stored in the docBase="ROOT"

What I would like to do is to be able to run 2 webapps. So I have created 2
DNS's for my server oc.mydomain.dk and oc3.mydomain.dk each pointing at the
same IP address.

In tomcat I have added an aditional host tag in the server.xml file which
now look like this
	
     <Host name="localhost" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
       	<Context path="" docBase="ROOT" debug="0"></Context>
      </Host>

	 <Host name="oc3.mydomain.dk" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
       <Context path="" docBase="OpenClinica3" debug="0"></Context>	 
      </Host>

If I enter the site with oc.mydomain.dk it goes correctly to the ROOT
docBase
If I enter the site with oc3.mydomain.dk it again goes to the ROOT docBase
but should have gone to the OpenClinica3 docBase. 
I know the OpenClinica3 docBase work because if I switch them arround it
just goes to OpenClinica3 all the time instead.


I have tried so many different combinations, so I hope somone here can help
me out.


Regards Putte
-- 
View this message in context: http://old.nabble.com/Problem-setting-up-multiple-hosts-tp27905530p27905530.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Problem setting up multiple hosts

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: puttea [mailto:putte.a@gmail.com]
> Subject: Problem setting up multiple hosts
> 
>      <Host name="localhost" appBase="webapps"
>        unpackWARs="true" autoDeploy="true"
>        xmlValidation="false" xmlNamespaceAware="false">
>        	<Context path="" docBase="ROOT" debug="0"></Context>
>       </Host>
> 	 <Host name="oc3.mydomain.dk" appBase="webapps"
>        unpackWARs="true" autoDeploy="true"
>        xmlValidation="false" xmlNamespaceAware="false">
>        <Context path="" docBase="OpenClinica3" debug="0"></Context>
>       </Host>

Don't put <Context> elements in server.xml - that requires restarting Tomcat whenever you need to change something in the webapp.  The <Context> element (if you need one at all) belongs in [appBase]/[appName]/META-INF/context.xml, and the path and docBase attributes must be removed.  Also, the debug attribute hasn't been used in quite some time.  After removing the undesirable attributes, you'll discover you don't actually need <Context> elements for these webapps.

As Mark's link pointed out, you should be using a separate appBase for each <Host>.

 - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Problem setting up multiple hosts

Posted by puttea <pu...@gmail.com>.
Thank you, now it works. I have missed the part about both had to be named
ROOT. :-(

Regards
Anders


n828cl wrote:
> 
>> From: puttea [mailto:putte.a@gmail.com]
>> Subject: RE: Problem setting up multiple hosts
>> 
>> 	<Host name="localhost" appBase="webapps/OpenClinica"
>>        unpackWARs="true" autoDeploy="true"
>>        xmlValidation="false" xmlNamespaceAware="false">
>>        </Host>
>> 
>> 	<Host name="oc3.signifikans.dk" appBase="webapps/OpenClinica3"
>>        unpackWARs="true" autoDeploy="true"
>>        xmlValidation="false" xmlNamespaceAware="false">
>>       </Host>
> 
> You're not following the documentation; neither of the above is correct. 
> Set the first appBase to "webapps", the second to "webapps3".  Place the
> default webapp for the first <Host> in webapps/ROOT.war (or webapps/ROOT,
> if you're not using a .war file).  Place the default webapp for the second
> <Host> in webapps3/ROOT.war.  Note that ROOT must be all caps.  DO NOT use
> the names OpenClinica or OpenClinica3 for your webapps; they must be named
> ROOT.
> 
>  - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Problem-setting-up-multiple-hosts-tp27905530p27918802.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Problem setting up multiple hosts

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: puttea [mailto:putte.a@gmail.com]
> Subject: RE: Problem setting up multiple hosts
> 
> 	<Host name="localhost" appBase="webapps/OpenClinica"
>        unpackWARs="true" autoDeploy="true"
>        xmlValidation="false" xmlNamespaceAware="false">
>        </Host>
> 
> 	<Host name="oc3.signifikans.dk" appBase="webapps/OpenClinica3"
>        unpackWARs="true" autoDeploy="true"
>        xmlValidation="false" xmlNamespaceAware="false">
>       </Host>

You're not following the documentation; neither of the above is correct.  Set the first appBase to "webapps", the second to "webapps3".  Place the default webapp for the first <Host> in webapps/ROOT.war (or webapps/ROOT, if you're not using a .war file).  Place the default webapp for the second <Host> in webapps3/ROOT.war.  Note that ROOT must be all caps.  DO NOT use the names OpenClinica or OpenClinica3 for your webapps; they must be named ROOT.

 - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Problem setting up multiple hosts

Posted by puttea <pu...@gmail.com>.
Hi Chuck

I have also tried this option whitout the context path and with different
appBase

	<Host name="localhost" appBase="webapps/OpenClinica"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
       </Host>

	<Host name="oc3.signifikans.dk" appBase="webapps/OpenClinica3"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false"> 
      </Host>

With this option i get 404 error on the first site and blank page on the
second site. I'm running on a Windows server if this has anything to say.
Also tried with "\" instead of "/" with any luck.


n828cl wrote:
> 
>> From: puttea [mailto:putte.a@gmail.com]
>> Subject: Re: Problem setting up multiple hosts
>> 
>> These informations have made me create the example
>> I posted in the first post. But this doesn't work.
> 
> Because you didn't follow the instructions.  Please read my other post.
> 
>  - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Problem-setting-up-multiple-hosts-tp27905530p27915509.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Problem setting up multiple hosts

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: puttea [mailto:putte.a@gmail.com]
> Subject: Re: Problem setting up multiple hosts
> 
> These informations have made me create the example
> I posted in the first post. But this doesn't work.

Because you didn't follow the instructions.  Please read my other post.

 - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem setting up multiple hosts

Posted by puttea <pu...@gmail.com>.
Hi Mark

Thank's for the reply, I have read that page, and also the page about,
engine, host and context. These informations have made me create the example
I posted in the first post. But this doesn't work.

By the way I can mentione that the defaultHost set in the engine is set to
localhost like the first host defined.



markt-2 wrote:
> 
> On 15/03/2010 15:00, puttea wrote:
>> I have tried so many different combinations, so I hope somone here can
>> help
>> me out.
> 
> http://tomcat.apache.org/tomcat-5.5-doc/virtual-hosting-howto.html
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Problem-setting-up-multiple-hosts-tp27905530p27905724.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem setting up multiple hosts

Posted by Mark Thomas <ma...@apache.org>.
On 15/03/2010 15:00, puttea wrote:
> I have tried so many different combinations, so I hope somone here can help
> me out.

http://tomcat.apache.org/tomcat-5.5-doc/virtual-hosting-howto.html

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org