I want to remove env-entry from WEb.XML
<env-entry>
<description>String used in masking process</description>
<env-entry-name>default_mask</env-entry-name>
<env-entry-value>*</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
so I created a properties file having (c:/my.properties)
default_mask=9999
So I try to use the existing solution like JndiPropertyPlaceholderConfigurer (from Spring Jndi Context and PropertyPlaceholderConfigurer ) and configured following in spring's applicationcontext.xml as
<bean
class="com.test.webappl.JndiPropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
<property name="ignoreResourceNotFound" value="true"/>
<property name="location" value="file:c:\my.properties"/>
Starting Tomcat server reads the property file like
.......com.test.webappl.JndiPropertyPlaceholderConfigurer] Loading properties file from URL [file:c:/my.properties]
Now in java when I read
Context context = new InitialContext();
String resource = context.lookup("java:comp/env/default_mask");
application throws following error
**javax.naming.NameNotFoundException: Name default_mask is not bound in this Context**
also my spring setting in web.xml are
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationcontext.xml</param-value>
</context-param>
Anybody knows if I'm using the correct way? I know this has been answered in Spring Jndi Context and PropertyPlaceholderConfigurer but somehow not working in my case
Thanks in Advance