This is quite similar question to one older but the solution did not work for me.
I have a WAR package.
In web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:application-context.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
In application-context.xml
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:social.properties</value>
</property>
</bean>
But getting this:
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/social.properties]
I checked the WAR package - .xml
and .properties
files are both in /WEB-INF/classes
.properties
file is in src/main/resources
and .xml
in src/main/java
(in default package both) and maven transports them (I think) correctly in the default package of WEB-INF/classes
Does anyone know why i could get this exception? Thank you.
EDIT: I just want to add that JUnit tests goes correctly (i mean they load what they should from social.properties
) but when running the app it ignores my classpath:
prefix
classpath:
prefix is actually there? – Roby/home/...-DEVELOPMENT-0.0.1.war
build successful. When I open the war and look at/WEB-INF/classes/application-context.xml
i see theclasspath:
prefix – Kajdan/WEB-INF
and not/WEB-INF/classes
? – Slanderclasses
– Dialogistclasspath:/social.properties
– Slanderdevelop.war
also. Look atMETA-INF
. – Kajdan