You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by hanan herzog <ju...@gmail.com> on 2008/09/03 22:43:01 UTC

Do context.xml Parameter value changes require Tomcat restart?

Hello,
    I am using context.xml to configure my web application. But when I
change values in the context.xml, the application does not see the changes,
unless I restart tomcat:

Setup:
Tomcat 6.0.18 (from distribution tarball, unmodified, except as explained
below)
Linux (Fedora 9)  2.6.25.14-108.fc9.i686
Java(TM) SE Runtime Environment (build 1.6.0_10-rc-b28)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)


I have a  http://www.nabble.com/file/p19297752/context.xml context.xml  in
~/local/tomcat/conf

With my browser, I go to http://localhost:8080/c to execute 
http://www.nabble.com/file/p19297752/index.jsp index.jsp  which is in
directory in ~/local/tomcat/webapps/c

The result is as expected, "valueONE".

But when I change the value="valueTWO" in the context.xml and re-run
index.jsp, the OLD value remains.
The application context is reloaded in some sense, but the new values of
context.xml are not available.

I thought the main reason to use context.xml is precisely so that
configuration changes can be made without having to restart the  tomcat
instance.

Am I doing something wrong?

Hanan

-- 
View this message in context: http://www.nabble.com/Do-context.xml-Parameter-value-changes-require-Tomcat-restart--tp19297752p19297752.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Do context.xml Parameter value changes require Tomcat restart?

Posted by hanan herzog <ju...@gmail.com>.
Hi,
   Yes, indeed Tomat does redeploy the app. That also gave me the warm and
fuzzy feeling that it must be loading the relevant context.xml anew as well. 
But sadly, it does not pick up changes to context.xml, at least not changes
to Parameter elements. 

Would you mind trying my little JSP out (attached in first message). I will
venture to say that you will see that the original value of the Parameter
sticks around forever, even after changing the value attribute and  tomcat
re-deploys the app. The redeploy by Tomcat is correctly triggered, but has
no effect (seems like a bug).

Cheers,

Hanan



Caldarale, Charles R wrote:
> 
>> From: hanan herzog [mailto:justhanan@gmail.com]
>> Subject: RE: Do context.xml Parameter value changes require
>> Tomcat restart?
>>
>> I tried putting the settings in context directories, e.g.,
>> conf/Catalina/localhost/context.xml.default . But changes to
>> this did not get picked up either.
> 
> Hmmm... I just tried it on a stock 6.0.18 running on WinXP, modifying
> attributes in conf/Catalina/localhost/[appName].xml, and Tomcat
> automatically redeployed the webapp.
> 
> Have you changed anything in conf/server.xml or conf/web.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 start a new topic, e-mail: users@tomcat.apache.org
> 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://www.nabble.com/Do-context.xml-Parameter-value-changes-require-Tomcat-restart--tp19297752p19301524.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Do context.xml Parameter value changes require Tomcat restart?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: hanan herzog [mailto:justhanan@gmail.com]
> Subject: RE: Do context.xml Parameter value changes require
> Tomcat restart?
>
> 1. If the new values are not going to be picked up
> from context.xml.default why does a change in
> conf/engine/host/context.xml.default or
> conf/context.xml cause a redeployment

Ah - didn't know that redeployment occurred.  In that case, this does sound like a bug.

> 2. I could have multiple engines configured, and the
> context.xml.default is a per-engine config file.

True, although that is rather unusual.

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


RE: Do context.xml Parameter value changes require Tomcat restart?

Posted by hanan herzog <ju...@gmail.com>.
 

Two things still leave a bad taste:

1. If the new values are not going to be picked up from context.xml.default
why does a change in conf/engine/host/context.xml.default or
conf/context.xml cause a redeployment (without an update in Parameter
values?)

2. I could have multiple engines configured, and the context.xml.default is
a per-engine config file. I may want to only have the applications of a
specific engine to be reloaded. Apps in other engines would not need
reloading, so it seems wasteful to restart the whole Tomcat instance.

The context xml loading behaviour of Tomcat still seems a bit whacky to me.

In any case, I am now able to do what I need to do, so all's good.

Thanks for your time,

Hanan

Caldarale, Charles R wrote:
> 
>> From: hanan herzog [mailto:justhanan@gmail.com]
>> Subject: RE: Do context.xml Parameter value changes require
>> Tomcat restart?
>>
>> Changing Parameter values in appName.xml works: redeployment
>> occurs, Parameter (InitParameter) values are updated as expected.
> 
> Good, because that's what I found to be true.
> 
>> However, changing values in context.xml.default still does
>> not work, which was what was stumping me. Also changes in
>> conf/context.xml do not get updated in a running Tomcat--as
>> far as I can tell.
>>
>> Is this by design?
> 
> Highly likely.  These files are global, so changing values in them would
> require redeployment of all webapps - you might as well just restart
> Tomcat in that case.
> 
> 
> 
>  - 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Do-context.xml-Parameter-value-changes-require-Tomcat-restart--tp19297752p19301757.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Do context.xml Parameter value changes require Tomcat restart?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: hanan herzog [mailto:justhanan@gmail.com]
> Subject: RE: Do context.xml Parameter value changes require
> Tomcat restart?
>
> Changing Parameter values in appName.xml works: redeployment
> occurs, Parameter (InitParameter) values are updated as expected.

Good, because that's what I found to be true.

> However, changing values in context.xml.default still does
> not work, which was what was stumping me. Also changes in
> conf/context.xml do not get updated in a running Tomcat--as
> far as I can tell.
>
> Is this by design?

Highly likely.  These files are global, so changing values in them would require redeployment of all webapps - you might as well just restart Tomcat in that case.

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


RE: Do context.xml Parameter value changes require Tomcat restart?

Posted by hanan herzog <ju...@gmail.com>.
I just tried again. Well, the problems turns out to be more subtle. Changing
Parameter values in appName.xml works: redeployment occurs, Parameter
(InitParameter) values are updated as expected.

However, changing values in context.xml.default still does not work, which
was what was stumping me. Also changes in conf/context.xml do not get
updated in a running Tomcat--as far as I can tell.

Is this by design?

Hanan



Caldarale, Charles R wrote:
> 
>> From: hanan herzog [mailto:justhanan@gmail.com]
>> Subject: RE: Do context.xml Parameter value changes require
>> Tomcat restart?
>>
>> I tried putting the settings in context directories, e.g.,
>> conf/Catalina/localhost/context.xml.default . But changes to
>> this did not get picked up either.
> 
> Hmmm... I just tried it on a stock 6.0.18 running on WinXP, modifying
> attributes in conf/Catalina/localhost/[appName].xml, and Tomcat
> automatically redeployed the webapp.
> 
> Have you changed anything in conf/server.xml or conf/web.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 start a new topic, e-mail: users@tomcat.apache.org
> 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://www.nabble.com/Do-context.xml-Parameter-value-changes-require-Tomcat-restart--tp19297752p19301601.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Do context.xml Parameter value changes require Tomcat restart?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: hanan herzog [mailto:justhanan@gmail.com]
> Subject: RE: Do context.xml Parameter value changes require
> Tomcat restart?
>
> I tried putting the settings in context directories, e.g.,
> conf/Catalina/localhost/context.xml.default . But changes to
> this did not get picked up either.

Hmmm... I just tried it on a stock 6.0.18 running on WinXP, modifying attributes in conf/Catalina/localhost/[appName].xml, and Tomcat automatically redeployed the webapp.

Have you changed anything in conf/server.xml or conf/web.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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Do context.xml Parameter value changes require Tomcat restart?

Posted by hanan herzog <ju...@gmail.com>.
Hi,
   I realize that conf/context.xml is not the place to put application
settings as this file is for Tomcat-instance-wide settings. I tried putting
the settings in context directories, e.g.,
conf/Catalina/localhost/context.xml.default . But changes to this did not
get picked up either. These seems to me like a bug in Tomcat.

Using META-INF/context.xml would not do it for me, because I want to leave
deployment-specific settings outside the webapp (outside its WAR). That way
I can easily deploy and upgrade of the code without blowing away settings
which are specific to that deployment/instance of the WAR.

In my case, there is an identical WAR which is copied around and deployed
for different customers, so my context.xml may have customer-specific
settings, for example.

What's the best-practice way to do this in the Tomcat environment?


Hanan


Caldarale, Charles R wrote:
> 
>> From: hanan herzog [mailto:justhanan@gmail.com]
>> Subject: Do context.xml Parameter value changes require
>> Tomcat restart?
>>
>> I am using context.xml to configure my web application.
> 
> Where is your context.xml located?  It should be under the webapp's
> META-INF directory.  The conf/context.xml file is shared across all
> webapps and must not be used for individual webapp settings.  Changes to
> that one do require a restart of Tomcat.
> 
>> But when I change values in the context.xml, the
>> application does not see the changes, unless I
>> restart tomcat:
> 
> You must at least restart the application.  Tomcat will normally do this
> automatically for you when you update the webapp's META-INF/context.xml,
> and you should see log entries to that effect.
> 
>  - 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Do-context.xml-Parameter-value-changes-require-Tomcat-restart--tp19297752p19301037.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Do context.xml Parameter value changes require Tomcat restart?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: hanan herzog [mailto:justhanan@gmail.com]
> Subject: Do context.xml Parameter value changes require
> Tomcat restart?
>
> I am using context.xml to configure my web application.

Where is your context.xml located?  It should be under the webapp's META-INF directory.  The conf/context.xml file is shared across all webapps and must not be used for individual webapp settings.  Changes to that one do require a restart of Tomcat.

> But when I change values in the context.xml, the
> application does not see the changes, unless I
> restart tomcat:

You must at least restart the application.  Tomcat will normally do this automatically for you when you update the webapp's META-INF/context.xml, and you should see log entries to that effect.

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