Note that there are some explanatory texts on larger screens.

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

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload