You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jo...@centrum.cz on 2011/03/02 13:50:09 UTC

How to setup webapp specific parameter for virtual host in Tomcat?

Hi everybody,
I would like to have this setup in Tomcat:

1. virtual host
2. webapp resides directly in ROOT and is autoDeployed
3. I need to pass some specific webapp parameter in Tomcat configuration (outside war)

1st I have this scenario:

<Host name="my.domain.com" appBase="vhosts/my.domain.com" unpackWARs="true" autoDeploy="true">
</Host>

and ROOT.war in directory $CATALINA_BASE/vhosts/my.domain.com/

-> everything works fine

2nd now I try to add the context parameter

<Host name="my.domain.com" appBase="vhosts/my.domain.com" unpackWARs="true" autoDeploy="true">
<Context docBase="/" reloadable="true">
<Parameter name="serverRole" value="dev" override="true"/>
</Context>
</Host>

-> app is no more accessible by my.domain.com (404)

-> I also tried to move the Context from Host to separate ROOT.xml file residing in $CATALINA_BASE/conf/Catalina/my.domain.com/ but with no success

Actually I don't know what to set for path or docBase, but it seems that I am lost.

With kind regards,
JoeK

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


RE: How to setup webapp specific parameter for virtual host in Tomcat?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Martin Gainty [mailto:mgainty@hotmail.com] 
> Subject: RE: How to setup webapp specific parameter for virtual host in Tomcat?

> docBase
> The value of this field must NOT be set when the Context is
>         configured using a META-INF/context.xml file 
> as it will be inferred by the automatic deployment process.

True but irrelevant, as the OP was not placing the <Context> element in META-INF/context.xml.

 - 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: How to setup webapp specific parameter for virtual host in Tomcat?

Posted by Martin Gainty <mg...@hotmail.com>.
docBase
The value of this field must NOT be set when the Context is
        configured using a META-INF/context.xml file 
as it will be
        inferred by the automatic deployment process.

Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> To: users@tomcat.apache.org
> Subject: How to setup webapp specific parameter for virtual host in Tomcat?
> Date: Wed, 2 Mar 2011 13:50:09 +0100
> From: joe.k@centrum.cz
> 
> 
> Hi everybody,
> I would like to have this setup in Tomcat:
> 
> 1. virtual host
> 2. webapp resides directly in ROOT and is autoDeployed
> 3. I need to pass some specific webapp parameter in Tomcat configuration (outside war)
> 
> 1st I have this scenario:
> 
> <Host name="my.domain.com" appBase="vhosts/my.domain.com" unpackWARs="true" autoDeploy="true">
> </Host>
> 
> and ROOT.war in directory $CATALINA_BASE/vhosts/my.domain.com/
> 
> -> everything works fine
> 
> 2nd now I try to add the context parameter
> 
> <Host name="my.domain.com" appBase="vhosts/my.domain.com" unpackWARs="true" autoDeploy="true">
> <Context docBase="/" reloadable="true">
> <Parameter name="serverRole" value="dev" override="true"/>
> </Context>
> </Host>
> 
> -> app is no more accessible by my.domain.com (404)
> 
> -> I also tried to move the Context from Host to separate ROOT.xml file residing in $CATALINA_BASE/conf/Catalina/my.domain.com/ but with no success
> 
> Actually I don't know what to set for path or docBase, but it seems that I am lost.
> 
> With kind regards,
> JoeK
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

Re: How to setup webapp specific parameter for virtual host in Tomcat?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joe,

On 3/2/2011 4:20 PM, joe.k@centrum.cz wrote:
> thank you for your reply. Based on your answer I tried to remove docBase attribute 
> in ROOT.xml and it started to work ! :-) 
> 
> The thing why it didn't come to my mind before is the fact that I thought 
> docBase attribute was mandatory attribute, as long as it's marked bold in Tomcat's 
> documentation: 
> 
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Common_Attributes 

docBase actually is required when the webapp is not being deployed via
an auto-deployed .WAR file (or manually deployed using the manager app).

The problem, now, is that you run the risk of double-deploying your ROOT
webapp: once because it is being auto-deployed and once because you are
explicitly deploying it.

The best thing for you to do is to remove the <Context> from your
server.xml file and instead modify the file
CATALINA_BASE/conf/[Service]/my.domain.name/ROOT.xml to include your
<Parameter> entries.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1xSo0ACgkQ9CaO5/Lv0PA57QCfSIAxVC8QlqySXvu1eV+dCjjF
H+AAn2CmDnf0wB+PdpaiOWaYD3AYKTcd
=fdB/
-----END PGP SIGNATURE-----

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


RE: How to setup webapp specific parameter for virtual host in Tomcat?

Posted by jo...@centrum.cz.
Hi Charles, 
thank you for your reply. Based on your answer I tried to remove docBase attribute 
in ROOT.xml and it started to work ! :-) 

The thing why it didn't come to my mind before is the fact that I thought 
docBase attribute was mandatory attribute, as long as it's marked bold in Tomcat's 
documentation: 

http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Common_Attributes 


Thank you ! 

JoeK 



______________________________________________________________
> Od: "Caldarale,  Charles R" <Ch...@unisys.com>
> Komu: Tomcat Users List <us...@tomcat.apache.org>
> Datum: 02.03.2011 15:24
> Předmět: RE: How to setup webapp specific parameter for virtual host in Tomcat?
>
>> From: joe.k@centrum.cz [mailto:joe.k@centrum.cz] 
>> Subject: How to setup webapp specific parameter for virtual host in Tomcat?
>
>> <Host name="my.domain.com" appBase="vhosts/my.domain.com" 
>>       unpackWARs="true" autoDeploy="true">
>> <Context docBase="/" reloadable="true">
>> <Parameter name="serverRole" value="dev" override="true"/>
>> </Context>
>> </Host>
>
>The docBase is incorrect, and the path is missing.  However, you really shouldn't be putting <Context> elements in server.xml, so the point is moot.
>
>> app is no more accessible by my.domain.com (404)
>
>Expected, given the invalid <Context> settings.
>
>> I also tried to move the Context from Host to separate 
>> ROOT.xml file residing in 
>> $CATALINA_BASE/conf/Catalina/my.domain.com/ but with no 
>> success
>
>Unlikely that Tomcat reports the error message "no success"; exactly what error are you getting with what URL?
>
>Did you check the logs for deployment errors?
>
>> Actually I don't know what to set for path or docBase, but 
>> it seems that I am lost.
>
>You must omit path (it's not allowed here).  You must also not specify docBase if the webapp is located within the <Host> appBase - as yours appears to be.
>
>Post your ROOT.xml from conf/Catalina/my.domain.com and your current conf/server.xml (but please remove the comments first to save space).
>
> - 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: How to setup webapp specific parameter for virtual host in Tomcat?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: joe.k@centrum.cz [mailto:joe.k@centrum.cz] 
> Subject: How to setup webapp specific parameter for virtual host in Tomcat?

> <Host name="my.domain.com" appBase="vhosts/my.domain.com" 
>       unpackWARs="true" autoDeploy="true">
> <Context docBase="/" reloadable="true">
> <Parameter name="serverRole" value="dev" override="true"/>
> </Context>
> </Host>

The docBase is incorrect, and the path is missing.  However, you really shouldn't be putting <Context> elements in server.xml, so the point is moot.

> app is no more accessible by my.domain.com (404)

Expected, given the invalid <Context> settings.

> I also tried to move the Context from Host to separate 
> ROOT.xml file residing in 
> $CATALINA_BASE/conf/Catalina/my.domain.com/ but with no 
> success

Unlikely that Tomcat reports the error message "no success"; exactly what error are you getting with what URL?

Did you check the logs for deployment errors?

> Actually I don't know what to set for path or docBase, but 
> it seems that I am lost.

You must omit path (it's not allowed here).  You must also not specify docBase if the webapp is located within the <Host> appBase - as yours appears to be.

Post your ROOT.xml from conf/Catalina/my.domain.com and your current conf/server.xml (but please remove the comments first to save space).

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