You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrei Ivanov <an...@gmail.com> on 2015/11/12 12:10:50 UTC

env-entry with mapped-name

Hi,
After reading https://bitbucket.org/sgarlick/demo/wiki/JNDI, I tried to
apply that to my app deployed on Tomcat:

Tomcat context.xml has this entry:
<Environment name="env/enss/profile" value="dev" type="java.lang.String" />

The application web.xml has this entry:
    <env-entry>
        <env-entry-name>spring.profiles.active</env-entry-name>
        <env-entry-type>java.lang.String</env-entry-type>
        <mapped-name>java:comp/env/env/enss/profile</mapped-name>
    </env-entry>

>From what I understand, when Spring looks up
java:comp/env/spring.profiles.active Tomcat should find it using the value
provided in the mapped-name.

It doesn't work and by looking at the Tomcat 8.0.28 sources, the
mapped-name is just added in the properties of ContextEnvironment, but it's
never used.

Did I misunderstand what the mapped-name should do?
Or is it a bug in Tomcat that it doesn't use mapped-name for anything?

Thank you

Re: env-entry with mapped-name

Posted by Andrei Ivanov <an...@gmail.com>.
Anybody? :-/

On Thu, Nov 12, 2015 at 1:10 PM, Andrei Ivanov <an...@gmail.com>
wrote:

> Hi,
> After reading https://bitbucket.org/sgarlick/demo/wiki/JNDI, I tried to
> apply that to my app deployed on Tomcat:
>
> Tomcat context.xml has this entry:
> <Environment name="env/enss/profile" value="dev" type="java.lang.String" />
>
> The application web.xml has this entry:
>     <env-entry>
>         <env-entry-name>spring.profiles.active</env-entry-name>
>         <env-entry-type>java.lang.String</env-entry-type>
>         <mapped-name>java:comp/env/env/enss/profile</mapped-name>
>     </env-entry>
>
> From what I understand, when Spring looks up
> java:comp/env/spring.profiles.active Tomcat should find it using the value
> provided in the mapped-name.
>
> It doesn't work and by looking at the Tomcat 8.0.28 sources, the
> mapped-name is just added in the properties of ContextEnvironment, but it's
> never used.
>
> Did I misunderstand what the mapped-name should do?
> Or is it a bug in Tomcat that it doesn't use mapped-name for anything?
>
> Thank you
>