java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]


      Click here to attend Spring Framework 4.x and certification course with a discount

If you get the following exception (While using the Spring Framework);

218 [main] ERROR org.springframework.web.context.ContextLoader – Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
atorg.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
atorg.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
atorg.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
atorg.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)

Either put the applicationContext*.xml inside WEB-INF or if you use different name for the configuration file use (Add these lines to web.xml file under /WEB-INF/ folder);

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/beans*.xml</param-value>
</context-param>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s