This is quite similar question to one older but the solution did not work for me.
I have a WAR package.
In web.xml
Put the things like /src/main/resources/foo/bar.properties
and then reference them as classpath:/foo/bar.properties
.
Try to use classpath*:
prefix instead.
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/resources.html#resources-classpath-wildcards
Also please try to deploy exploded war, to ensure that all files are there.
Mark sure propertie file is in "/WEB-INF/classes" try to use
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>/WEB-INF/classes/social.properties</value>
</property>
</bean>
I had the same error.
My filename was jpaContext.xml
and it was placed in src/main/resources
. I specified param value="classpath:/jpaContext.xml"
.
Finally I renamed the file to applicationContext.xml
and moved it to the WEB-INF directory and changed param value to /WEB-INF/applicationContext.xml
, then it worked!
Are you having Tomcat unpack the WAR file? It seems that the files cannot be found on the classpath when a WAR file is loaded and it is not being unpacked.
Do not use classpath. This may cause problems with different ClassLoaders (container vs. application). WEB-INF is always the better choice.
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-config.xml</param-value>
</context-param>
and
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>/WEB-INF/social.properties</value>
</property>
</bean>