wood burning stoves 2.0*
The moose likes Spring and the fly likes Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException" Watch "Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException" New topic

Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException

sirisha mullapudi

Joined: Mar 05, 2008
Posts: 8
Hi, i am getting the below exception.I was able to ran the sample example with annotations. But without them,i am getting the below exception
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/SpringMVCTutorial-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/SpringMVCTutorial-servlet.xml]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/SpringMVCTutorial-servlet.xml]
at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:118)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
I have all 3.0.0 Release jars in my eclipse.
can you please help with this. appreciate your quick help

Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

What's your spring context file named? When you specify your DispatcherServlet in your web.xml, it assumes that it's named "<servlet-name-of-dispatcher-servlet>-servlet.xml".

I'm assuming yours is defined something like:

which looks for "SpringMVCTutorial-servlet.xml".

You can change your DispatcherServlet's servlet-name to match your context file, rename the context file to match the servlet-name of the DispatcherServlet, or specify the name of the context file using either the "contextConfigLocation" init-param (to specify the path and full name of the file) or "namespace" init-param (to specify a name other than the servlet-name) on the DispatcherServlet.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
sirisha mullapudi

Joined: Mar 05, 2008
Posts: 8
Thanks Nathan.I just rechecked my xml name.By mistake i gave SpringMVCTutorial_servlet.xml instead of SpringMVCTutorial-servlet.xml. I have corrected it and now it is working fine. Thanks for the Quick Response.

I agree. Here's the link: http://aspose.com/file-tools
subject: Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException