Spring配置文件给出了BeanDefinitionStoreException
问题内容:
我试图在以下位置完成Spring MVC教程: http://static.springsource.org/docs/Spring-MVC-step-
by-step/part1.html
但是,这些解决方案似乎都不相关。
我得到以下堆栈跟踪:
org.springframework.beans.factory.BeanDefinitionStoreException:来自ServletContext资源[/WEB-
INF/springapp-
servlet.xml]的XML文档中的第6行无效;嵌套的异常是org.xml.sax.SAXParseException:文档根元素“
beans”,必须与DOCTYPE根“
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。
我将其作为我的springapp-servlet.xml文件。
<?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>
问题答案: