标题:spring开发遇到的问题
取消只看楼主
bjgs2004
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-3-18
 问题点数:0 回复次数:2 
spring开发遇到的问题
我是spring的初学者,我今天编了一个基于spring的程序(在eclpse3.2环境下),但是运行时候出现了下列信息,不知道问题出在哪,请各位指点一下:


"2007-3-31 22:55:58 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [D:\Program Files\eclipse\My workspace\springDemo\beans-config.xml]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Line 2 in XML document from file [D:\Program Files\eclipse\My workspace\springDemo\beans-config.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".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:222)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:173)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:68)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:56)
at springDemo.springDemo.main(springDemo.java:16)


我的xml的内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="helloBean"
class="springDemo.helloBean">
<property name="helloworld">
<value>hello world!</value>
</property>
</bean>
</beans>
"

[此贴子已经被作者于2007-3-31 23:07:32编辑过]

搜索更多相关主题的帖子: spring 开发 
2007-03-31 23:01
bjgs2004
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-3-18
得分:0 
不好意思,我编辑的时候,选了html格式,所以很晕.
这个问题我解决了,是插件的问题,不过又出现了新的问题:
我装了Myeclipse5.1 运行时候结果出来了,但是出现了:
log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).
log4j:WARN Please initialize the log4j system properly.
不知道是什么原因?怎么解解决啊?
2007-04-01 17:01
bjgs2004
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-3-18
得分:0 
回复:(bjgs2004)spring开发遇到的问题
编了一个log文档,问题解决了,谢谢各位.
2007-04-02 23:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-128440-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.656348 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved