You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by pa...@rufflar.com on 2011/01/12 10:37:58 UTC

Environment parameter overriding

Hi,

I've got a question regarding enviroment parameters:
Imagine a web application which web.xml defines an environment  
(env-entry) parameter (even empty) myParameter:

    <env-entry>
      <description>test</description>
      <env-entry-name>myParameter</env-entry-name>
      <env-entry-type>java.lang.String</env-entry-type>
      <env-entry-value></env-entry-value>
    </env-entry>


I now like to override the value of this environment parameter using  
the server.xml of the server (or tomcat admin):
        <Context ....>
        <Environment
             description="test"
             name="myParameter"
             type="java.lang.String"
             value="test"/>
        </Context>


I'm having the problem that the application only "sees" the old value  
(which is defined in the web.xml). I am reading the value using JNDI:

new InitialContext().lookup("java:comp/env/myParameter");

I can reproduce this behaviour in tomcat 5.5 and tomcat 6.0.
Who can help me?

Thank you for your help and best regards,

Patric



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


Re: Environment parameter overriding

Posted by Mark Thomas <ma...@apache.org>.
On 12/01/2011 15:09, Caldarale, Charles R wrote:
> What "tomcat administration interface" are you referring to?  The manager app certainly doesn't write into server.xml, and there is no other "administration interface" in any supported version of Tomcat.
It is in 5.5.x which is still supported.

Mark

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


RE: Environment parameter overriding

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: patric@rufflar.com [mailto:patric@rufflar.com] 
> Subject: RE: Environment parameter overriding

> <Context path="/trunk">
>   <Listener className="org.apache.catalina.startup.TldConfig"/>
>   <Listener className="org.apache.catalina.startup.TldConfig"/>
>   <Environment
>     name="myParameter"
>     type="java.lang.String"
>     value="test"/>
> </Context>

The above is missing override="false" in the <Environment> element, and has duplicated <Listener> elements, which can't be right.

> > (And if you've put the <Context> in server.xml as your first message  
> > implied, you've already made the first mistake.)

> The tomcat administration interface did this.

What "tomcat administration interface" are you referring to?  The manager app certainly doesn't write into server.xml, and there is no other "administration interface" in any supported version of Tomcat.

Your <Context> element should be located within the webapp at META-INF/context.xml, and the path attribute should be removed.  Make sure there's not another copy of the <Context> element in conf/Catalina/[host]/[appName].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: Environment parameter overriding

Posted by pa...@rufflar.com.
> Post your <Context> setting for the webapp of interest.

         <Context path="/trunk">
           <Listener className="org.apache.catalina.startup.TldConfig"/>
           <Listener className="org.apache.catalina.startup.TldConfig"/>
           <Environment
             name="myParameter"
             type="java.lang.String"
             value="test"/>
         </Context>

> (And if you've put the <Context> in server.xml as your first message  
> implied, you've already made the first mistake.)

The tomcat administration interface did this.

Thank you
Patric


Zitat von "Caldarale, Charles R" <Ch...@unisys.com>:

>> From: patric@rufflar.com [mailto:patric@rufflar.com]
>> Subject: Re: Environment parameter overriding
>
>> The override setting does not seem to have any effect, I tried all 3
>> values (true, false and to rely on the default)
>
> Post your <Context> setting for the webapp of interest.  (And if  
> you've put the <Context> in server.xml as your first message  
> implied, you've already made the first mistake.)
>
>  - 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
>
>





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


RE: Environment parameter overriding

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: patric@rufflar.com [mailto:patric@rufflar.com] 
> Subject: Re: Environment parameter overriding

> The override setting does not seem to have any effect, I tried all 3  
> values (true, false and to rely on the default)

Post your <Context> setting for the webapp of interest.  (And if you've put the <Context> in server.xml as your first message implied, you've already made the first mistake.)

 - 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: Environment parameter overriding

Posted by pa...@rufflar.com.
I've tested it with
Tomcat 5.5.31, 5.5.25 and 6.0.29

Zitat von Mark Thomas <ma...@apache.org>:

> On 12/01/2011 14:27, patric@rufflar.com wrote:
>>> Particularly override
>> Unfortunately not.
>> The override setting does not seem to have any effect, I tried all 3
>> values (true, false and to rely on the default)
>
> Exact Tomcat version?
>
> Mark
>
>>
>>
>> Zitat von Mark Thomas <ma...@apache.org>:
>>
>>> On 12/01/2011 09:37, patric@rufflar.com wrote:
>>>> Hi,
>>>>
>>>> I've got a question regarding enviroment parameters:
>>>> Imagine a web application which web.xml defines an environment
>>>> (env-entry) parameter (even empty) myParameter:
>>>>
>>>>    <env-entry>
>>>>      <description>test</description>
>>>>      <env-entry-name>myParameter</env-entry-name>
>>>>      <env-entry-type>java.lang.String</env-entry-type>
>>>>      <env-entry-value></env-entry-value>
>>>>    </env-entry>
>>>>
>>>>
>>>> I now like to override the value of this environment parameter using the
>>>> server.xml of the server (or tomcat admin):
>>>>        <Context ....>
>>>>        <Environment
>>>>             description="test"
>>>>             name="myParameter"
>>>>             type="java.lang.String"
>>>>             value="test"/>
>>>>        </Context>
>>>>
>>>>
>>>> I'm having the problem that the application only "sees" the old value
>>>> (which is defined in the web.xml). I am reading the value using JNDI:
>>>>
>>>> new InitialContext().lookup("java:comp/env/myParameter");
>>>>
>>>> I can reproduce this behaviour in tomcat 5.5 and tomcat 6.0.
>>>> Who can help me?
>>>
>>> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Environment_Entries
>>>
>>>
>>> Particularly override
>>>
>>> Mark
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>





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


Re: Environment parameter overriding

Posted by Mark Thomas <ma...@apache.org>.
On 12/01/2011 14:27, patric@rufflar.com wrote:
>> Particularly override
> Unfortunately not.
> The override setting does not seem to have any effect, I tried all 3
> values (true, false and to rely on the default)

Exact Tomcat version?

Mark

> 
> 
> Zitat von Mark Thomas <ma...@apache.org>:
> 
>> On 12/01/2011 09:37, patric@rufflar.com wrote:
>>> Hi,
>>>
>>> I've got a question regarding enviroment parameters:
>>> Imagine a web application which web.xml defines an environment
>>> (env-entry) parameter (even empty) myParameter:
>>>
>>>    <env-entry>
>>>      <description>test</description>
>>>      <env-entry-name>myParameter</env-entry-name>
>>>      <env-entry-type>java.lang.String</env-entry-type>
>>>      <env-entry-value></env-entry-value>
>>>    </env-entry>
>>>
>>>
>>> I now like to override the value of this environment parameter using the
>>> server.xml of the server (or tomcat admin):
>>>        <Context ....>
>>>        <Environment
>>>             description="test"
>>>             name="myParameter"
>>>             type="java.lang.String"
>>>             value="test"/>
>>>        </Context>
>>>
>>>
>>> I'm having the problem that the application only "sees" the old value
>>> (which is defined in the web.xml). I am reading the value using JNDI:
>>>
>>> new InitialContext().lookup("java:comp/env/myParameter");
>>>
>>> I can reproduce this behaviour in tomcat 5.5 and tomcat 6.0.
>>> Who can help me?
>>
>> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Environment_Entries
>>
>>
>> Particularly override
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Re: Environment parameter overriding

Posted by pa...@rufflar.com.
> Particularly override
Unfortunately not.
The override setting does not seem to have any effect, I tried all 3  
values (true, false and to rely on the default)


Zitat von Mark Thomas <ma...@apache.org>:

> On 12/01/2011 09:37, patric@rufflar.com wrote:
>> Hi,
>>
>> I've got a question regarding enviroment parameters:
>> Imagine a web application which web.xml defines an environment
>> (env-entry) parameter (even empty) myParameter:
>>
>>    <env-entry>
>>      <description>test</description>
>>      <env-entry-name>myParameter</env-entry-name>
>>      <env-entry-type>java.lang.String</env-entry-type>
>>      <env-entry-value></env-entry-value>
>>    </env-entry>
>>
>>
>> I now like to override the value of this environment parameter using the
>> server.xml of the server (or tomcat admin):
>>        <Context ....>
>>        <Environment
>>             description="test"
>>             name="myParameter"
>>             type="java.lang.String"
>>             value="test"/>
>>        </Context>
>>
>>
>> I'm having the problem that the application only "sees" the old value
>> (which is defined in the web.xml). I am reading the value using JNDI:
>>
>> new InitialContext().lookup("java:comp/env/myParameter");
>>
>> I can reproduce this behaviour in tomcat 5.5 and tomcat 6.0.
>> Who can help me?
>
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Environment_Entries
>
> Particularly override
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>





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


Re: Environment parameter overriding

Posted by Mark Thomas <ma...@apache.org>.
On 12/01/2011 09:37, patric@rufflar.com wrote:
> Hi,
> 
> I've got a question regarding enviroment parameters:
> Imagine a web application which web.xml defines an environment
> (env-entry) parameter (even empty) myParameter:
> 
>    <env-entry>
>      <description>test</description>
>      <env-entry-name>myParameter</env-entry-name>
>      <env-entry-type>java.lang.String</env-entry-type>
>      <env-entry-value></env-entry-value>
>    </env-entry>
> 
> 
> I now like to override the value of this environment parameter using the
> server.xml of the server (or tomcat admin):
>        <Context ....>
>        <Environment
>             description="test"
>             name="myParameter"
>             type="java.lang.String"
>             value="test"/>
>        </Context>
> 
> 
> I'm having the problem that the application only "sees" the old value
> (which is defined in the web.xml). I am reading the value using JNDI:
> 
> new InitialContext().lookup("java:comp/env/myParameter");
> 
> I can reproduce this behaviour in tomcat 5.5 and tomcat 6.0.
> Who can help me?

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

Particularly override

Mark

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