Reputation: 1291
When trying to run project on Tomcat I get:
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
My applicationContext.xml file is located under src/main/java/applicationContext.xml.
src/main/java is configured as a source folder in the build path of my Eclipse project, so I'm not understanding why Tomcat is not finding applicationContext.xml?
Upvotes: 0
Views: 3045
Reputation: 51
You should give correct path of the context file, as given below
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
As BeanDefinitionStoreException is thrown when a BeanFactory encounters an invalid bean definition: e.g. in case of incomplete or contradictory bean metadata.
Upvotes: 0
Reputation: 3507
try to put it under WEB-INF directory and do like below
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
</context-param>
Upvotes: 1