0

我正在使用 grails 2.1.1 版本和 tomcat 6.0,而当我部署 war 文件时,我遇到了这样的异常:

2012-12-11 12:20:03,891 [main] ERROR context.ContextLoader  - Context initialization failed
        org.springframework.beans.factory.BeanDefinitionStoreException: Line 4 in XML document from ServletContext resource [/WEB-INF/applicationContext.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 org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
            at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
            at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
            at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
            at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)
            at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
            at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
            at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
            at org.apache.xerces.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)

任何有想法的人都会有很大帮助。

谢谢。

阿纳根德拉

4

1 回答 1

0

检查 tomcat 中是否存在旧版本的 Spring 库。错误信息

org.xml.sax.SAXParseException:文档根元素“beans”,必须匹配 DOCTYPE 根“null”。

表示使用的 DTD 和提供的库之间存在某种版本不匹配

于 2012-12-11T11:02:48.807 回答