`
Surlymo
  • 浏览: 95613 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

备忘Document root element "beans",must match DOCTYPE root "null"

阅读更多
原因在网上一搜一大堆,比如这篇
http://seenow.blog.hexun.com/19253270_d.html。

转帖如下:


遇到一个新问题,ssh项目部署时遇到Document root element "beans", must match DOCTYPE root "null".的错误提示,网上很多人说要把applicationContex.xml文件中加上如下第二行的<!DOCTYPE/>标签,说明DTD,其实并不准确。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
……
</beans>
    后来在spring forum上发现了正解:
You have the wrong xml configuration for the version of spring.

1.x use DOCTYPE
2.x use schema

You must have 1.x in the classpath.
引自http://forum.springframework.org/showthread.php?t=37883

    现在明白了,spring 1.x 使用DOCTYPE,而2.x是用schema,我的项目出错原因是由于前面的其他错误怀疑spring版本问题把spring2.0换成了spring1.2,但applicationContex.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.0.xsd">
    更换spring为2.0问题解决。



==============转帖完毕========我是华丽的分割线============================



在使用maven的过程中如果引入了非常多的依赖导致即使找到了spring1.x的包也不知道是哪个依赖引进来的,这个时候有个小技巧:

1、点开“Maven Dependencies”
2、找出spring1.x的包
3、点击右键 --> MAVEN --> Exclude Maven artifact --> 点OK --> done

通过以上三步,可以很轻松的让Maven自动帮你去掉相应依赖中spring1.x的引入。如下所示:

		<dependency>
			<groupId>xbean</groupId>
			<artifactId>xbean-spring</artifactId>
			<version>2.1</version>
			<exclusions>
				<exclusion>
					<artifactId>spring</artifactId>
					<groupId>org.springframework</groupId>
				</exclusion>
			</exclusions>
		</dependency>




分享到:
评论

相关推荐

    dubbo找不到dubbo.xsd报错

    构建dubbo项目的时候会遇到: Multiple annotations found at this line: - cvc-complex-type.2.4.c: The matching wildcard is strict, but no ... 3) the root element of the document is not &lt;xsd:schema&gt;.

    Beans使用 Beans使用

    Beans使用 Beans使用 Beans使用

    spring-beans.jar

    org.springframework.beans-2.5.5.A.jar, org.springframework.beans-2.5.6.A.jar, org.springframework.beans-2.5.6.SEC01.jar, org.springframework.beans-3.0.0.M1.jar, org.springframework.beans-3.0.0.M2.jar,...

    spring-beans-5.2.0.RELEASE-API文档-中文版.zip

    赠送jar包:spring-beans-5.2.0.RELEASE.jar; 赠送原API文档:spring-beans-5.2.0.RELEASE-javadoc.jar; 赠送源代码:spring-beans-5.2.0.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-beans-5.2.0....

    spring-beans-5.0.10.RELEASE-API文档-中文版.zip

    赠送jar包:spring-beans-5.0.10.RELEASE.jar; 赠送原API文档:spring-beans-5.0.10.RELEASE-javadoc.jar; 赠送源代码:spring-beans-5.0.10.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-beans-5.0.10....

    webbeans 入门手册

    webbeans入门,javaEE6中cdi规范的详细介绍。

    开发工具 spring-beans-4.3.6.RELEASE

    开发工具 spring-beans-4.3.6.RELEASE开发工具 spring-beans-4.3.6.RELEASE开发工具 spring-beans-4.3.6.RELEASE开发工具 spring-beans-4.3.6.RELEASE开发工具 spring-beans-4.3.6.RELEASE开发工具 spring-beans-...

    spring-beans-5.2.0.RELEASE-API文档-中英对照版.zip

    赠送jar包:spring-beans-5.2.0.RELEASE.jar; 赠送原API文档:spring-beans-5.2.0.RELEASE-javadoc.jar; 赠送源代码:spring-beans-5.2.0.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-beans-5.2.0....

    spring-beans-5.3.7-API文档-中英对照版.zip

    赠送jar包:spring-beans-5.3.7.jar; 赠送原API文档:spring-beans-5.3.7-javadoc.jar; 赠送源代码:spring-beans-5.3.7-sources.jar; 赠送Maven依赖信息文件:spring-beans-5.3.7.pom; 包含翻译后的API文档:...

    Android代码-random-beans

    Random Beans Because life is too short to generate random Java™ beans by hand.. Latest news 27/01/2019: Version 3.8.0 is finally out! Checkout what's new in the change log. 19/06/2017: ...

    spring-beans-5.1.0.RELEASE

    spring-beans-5.1.0.RELEASE,最新spring-bean jar包。

    net beans 使用说明

    net beans 使用说明

    spring-beans-3.0.xsd

    spring-beans-3.0.xsd

    spring-beans.zip

    包含spring-beans-4.0.0.RELEASE.jar,spring-beans-4.1.0.RELEASE.jar,spring-beans-4.2.0.RELEASE.jar,

    spring-beans源码

    spring-beans源码,可以直接导入Eclipse工程里面

    spring beans jar

    spring beans jar包,需要另外3个包。加上log4j和logging

    spring-beans-4.3.12.RELEASE-API文档-中文版.zip

    赠送jar包:spring-beans-4.3.12.RELEASE.jar; 赠送原API文档:spring-beans-4.3.12.RELEASE-javadoc.jar; 赠送源代码:spring-beans-4.3.12.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-beans-4.3.12....

    spring-beans-5.1.3.RELEASE-API文档-中文版.zip

    赠送jar包:spring-beans-5.1.3.RELEASE.jar; 赠送原API文档:spring-beans-5.1.3.RELEASE-javadoc.jar; 赠送源代码:spring-beans-5.1.3.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-beans-5.1.3....

    spring-beans-4.3.20.RELEASE-API文档-中文版.zip

    赠送jar包:spring-beans-4.3.20.RELEASE.jar; 赠送原API文档:spring-beans-4.3.20.RELEASE-javadoc.jar; 赠送源代码:spring-beans-4.3.20.RELEASE-sources.jar; 包含翻译后的API文档:spring-beans-4.3.20....

Global site tag (gtag.js) - Google Analytics