Spring configuration file gives BeanDefinitionStoreException

I am trying to complete the Spring MVC tutorial at: http://static.springsource.org/docs/Spring-MVC-step-by-step/part1.html

My problem is similar to this one Spring configuration error

However none of those solutions seem relevant.

I am getting the following stack trace:

org.springframework.beans.factory.BeanDefinitionStoreException: Line 6 in XML document from resource [/WEB-INF/springapp-servlet.xml] of ServletContext is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:133) org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:125) org.springframework.context.support.AbstractXmlApplicationContext.refreshBeanFactory(AbstractXmlApplicationContext.java:65) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:226) org.springframework.web.context.support.XmlWebApplicationContext.refresh(XmlWebApplicationContext.java:131) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:281) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:229) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:199) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:102) javax.servlet.GenericServlet.init(GenericServlet.java:212) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:883) org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:722) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2214) java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) java.lang.Thread.run(Unknown Source)

I have this as my springapp-servlet.xml file.

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

  <!-- the application context definition for the springapp DispatcherServlet -->

  <bean name="/hello.htm" class="springapp.web.HelloController"/>

</beans>

Answers


You probably have some old spring jar files in your classpath.

See also this forum post.


I had the same problem. yes, this is due to wrong version of spring jar in your class path.


The problem will be due to old spring related jar files. So, update the jar files with the latest one, it will resolve your issue.


Need Your Help

Objective C Dismissing The Keyboard On Scroll of Another View [UIScrollViewKeyboardDismissModeInteractive]

ios iphone objective-c keyboard

I'm working on implementing a similar view to Apple's Messages app (iOS 7). I've already got all the code in place to have the toolbar attached to the top of the keyboard functionally.

What does appending "?v=1" to CSS and Javascript URLs in link and script tags do?

html css browser-cache

I have been looking at a HTML 5 boilerplate template (from http://html5boilerplate.com/) and noticed the use of "?v=1" in URLs when referring to CSS and Javascript files.