Note that there are some explanatory texts on larger screens.

plurals
  1. POCould not open ServletContext resource
    text
    copied!<p>This is quite similar question to one older but the solution did not work for me.</p> <p>I have a WAR package.</p> <p>In <code>web.xml</code></p> <pre><code>&lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;classpath:application-context.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;listener&gt; &lt;listener-class&gt; org.springframework.web.context.ContextLoaderListener &lt;/listener-class&gt; &lt;/listener&gt; </code></pre> <p>In <code>application-context.xml</code></p> <pre><code>&lt;bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;property name="location"&gt; &lt;value&gt;classpath:social.properties&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre> <p>But getting this:</p> <blockquote> <p>org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/social.properties]</p> </blockquote> <p>I checked the WAR package - <code>.xml</code> and <code>.properties</code> files are both in <code>/WEB-INF/classes</code></p> <p><code>.properties</code> file is in <code>src/main/resources</code> and <code>.xml</code> in <code>src/main/java</code> (in default package both) and maven transports them (I think) correctly in the default package of <code>WEB-INF/classes</code></p> <p>Does anyone know why i could get this exception? Thank you.</p> <p>EDIT: I just want to add that JUnit tests goes correctly (i mean they load what they should from <code>social.properties</code>) but when running the app it ignores my <code>classpath:</code> prefix</p>
 

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