You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Igor <ia...@ukr.net> on 2004/10/22 09:24:56 UTC

Environment entries question

Hello!

I created environment entry in web.xml:

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

This entry is used in the following way:

    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    String value = (String) envCtx.lookup("test");

Then I tried to change this environment entry using admin application. It was changed correctly in admin application, but code, listed above, returns old value.

I know two ways of how to make this code know of new value:

1. Change it in web.xml and restart tomcat
2. Change it in admin application and reload corresponding context

I do not like both of these ways.

Could somebody please tell me - is there a way of changing environment entry value, so that code, described above will see new value? 

Thank you in advance,
Igor