Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
sirisha mullapudi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Thanks,
SIreesha
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sirisha mullapudi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks,
Sireesha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic