初学Spring遇到的第一个问题:bean.xml

   问题:

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Line 2 in XML document from file [D:/Eclipse Workspace/MyEclipse 5.1/workspace/spring1/bean.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".

解决方法:
加一行:<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" " http://www.springframework.org/dtd/spring-beans.dtd">
原因:没有申明类型即DTD文档类型定义

你可能感兴趣的:(spring,thread,exception,File,文档,nested)