java.io.FileNotFoundException: class path resource [timex-servlet.properties] cannot be opened because it does not exist
filenotfoundexception, properties-file, spring, timex
Solution
ensure the file is placed in the `/WEB-INF/classes` folder and use `classpath:/timex-servlet.properties` (note the slash after classpath:)
Problem
I'm getting the following error message when I try to start a spring web application: ``` 2012-04-12 13:53:20,491 ERROR [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [timex-servlet.properties] cannot be opened because it does not exist java.io.FileNotFoundException: class path resource [timex-servlet.properties] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:137) at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:172) ``` I'm running Tomcat (version 6.x) through eclipse. I tried putting timex-servlet.properties in the following directories but to no avail: ``` WebContent\WEB-INF WebContent\WEB-INF\classes WebContent\ ``` Here is the reference to timex-servlet.properties in timex-servlet.xml: ``` <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="timex-servlet.properties" /> </bean> ``` There are several SO threads dealing with the same message that say to put a classpath: in front of the properties file reference. So I tried the following, which also did not work: ``` <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="classpath:timex-servlet.properties" /> </bean> ```